Q:

how to built the negation of the universal and existential quantifiers?

In my university I study a subject called logic programming and cognitive systems.There we learn about universal and existential quantifiers.I have a doubt with negation of these quantifiers.can any one explain the equations which are below are correct?I am confused about 1st and 3rd equations.most text books show it this way.
∼(∀x in D, Q(x)) ≡ ∃x in D such that ∼Q(x) ,
∼(∃x in D such that Q(x)) ≡ ∀x in D,∼Q(x) (copied from discrete mathematics from applications ,SUSSANNA S. EPP)
Quantifiers negation rule:
\begin{align}
\forall x f(x) &= \lnot \exists x \, \lnot f(x) \\
\forall x \lnot f(x) &= \lnot \exists x \, f(x) \\
\exists x f(x) &= \lnot \forall x \, \lnot f(x) \\
\exists x \lnot f(x) &= \lnot \forall x \, f(x) 
\end{align}

A:

My guess is that you are having some trouble understanding why these math statements are true.
Let me convert the math language into very broad, bland English sentences.
First off, if unfamiliar, $\exists$ means "There exists" and $\forall$ means "For all". Let's let $x$ be "some object" (I know, very bland). And let's let $f(x)$ mean that this something "works". The symbol $\neg$ refers to the negation, or opposite, which I will simply use the word "not" in my English translation. 
Using the first one as an example we have $$\color{blue}{\forall x, f(x)} \equiv \color{red}{\neg(\exists x), \neg \Bigl( f(x) \Bigr)}$$
Translating into words, we have:
$\color{blue}{\text{All objects work}} \text{ is logically equivalent to }\color{red}{\text{there does not exist an object that does not work}}$
Hopefully it is clear that this sentence is correct logically. Having everything working is the same as saying we don't have one that doesn't work.
See if you can now see why the other three are correct! :)

