Is $\neg(p \iff q) \equiv \neg p \iff \neg q$ valid?

For the question if the following is valid, I get false, but the book says the answer is true but doesn't explain why $$\neg(p \iff q) \equiv \neg p \iff \neg q$$

The way I worked out the answer was expanding the left-hand side equation $$p \rightarrow q \land q \rightarrow p$$ $$(\neg p \lor q) \land (q \rightarrow p)$$ $$\neg(p \land \neg q) \land \neg(q \land p)$$ $$\neg p \lor q \lor q \lor \neg p)$$ $$(p \rightarrow \neg q) \lor (\neg q \rightarrow \neg p)$$

But this is not equivalent to $$\neg p \iff \neg q$$

Can someone help explain where I am going wrong?

• How is one supposed to parse $\neg(p \iff q) \equiv \neg p \iff \neg q$? The lack of parentheses makes this non-nonsensical. – Git Gud Jan 27 '19 at 18:21
• $\neg(p\leftrightarrow q)$ is not equivalent to $\neg p\leftrightarrow \neg q$. $\neg p\leftrightarrow \neg q$ is equivalent to $p\leftrightarrow q$. I doubt that a book would make such a gross mistake. Which book is it? – Jishin Noben Jan 27 '19 at 18:24

Since $$p,\,q$$ have the same truth-values iff $$\neg p,\,\neg q$$ do, $$(p\iff q)\equiv (\neg p\iff\neg q)$$. In particular, $$(p\iff q)\not\equiv \neg(\neg p\iff\neg q)\equiv (p\iff\neg q)$$. In fact, we're working out the exclusive or of $$p,\,q$$. If you want to prove any of these results by your preferred techniques, first write $$\neg (p\iff q)\equiv\neg ((\neg p\lor q)\land (\neg q\lor p))\equiv(p\land\neg q)\lor (q\land\neg p).$$