# What law of algebra of proposition is happening here?

I'm preparing for a test tomorrow and going over some reading material, and I came across this problem that was worked out. So far I think I'm following each step of logic, but I've hit a wall with this part:

(p $\land$ ($\lnot$(r $\land$ q))) $\lor$ (($\lnot$p $\lor$ (r $\land$ q)))

is logically equivalent to

(p $\lor$ $\lnot$p $\lor$ ((r $\lor$ q)) $\land$ (($\lnot$(r $\land$ q)) $\lor$ $\lnot$p $\lor$ (r $\lor$ q))

I'm stumped as to what law is applied that allows you to go from the first and conclude the second.

-
They’re both tautologies. –  Brian M. Scott Jun 4 '13 at 2:43

if you make $s=r\wedge q$, then the first statement is written as $(p\wedge\neg s)\vee(\neg p\vee s)=(p\wedge\neg s)\vee\neg(p\wedge\neg s)=1$. This last equality is due to the fact that $x\vee\neg x=1$ for all $x$.
If you also make $t=r\vee q$, the second statement can be written as $p\vee\neg p\vee t\wedge(\neg s\vee\neg p\vee t)=1$, this last equality is due to the fact that $p\vee\neg p=1$ and $1\vee\cdot=1$
There’s an extra parenthesis in the second one; it may be that it’s supposed to be $$\Big(p\lor\neg p\lor(r\lor q)\Big)\land\Big(\neg(r\land q)\lor\neg p\lor(r\lor q)\Big)\;,$$ in which case it reduces instead to $1\land 1$. –  Brian M. Scott Jun 4 '13 at 3:04
I'm getting confused by where that first $\lnot$p comes from that appears in the second of the two lines. –  Harry Tuttle Jun 4 '13 at 4:52