Can someone explain how the cartesian equation is formed? Can someone explain how the cartesian equation of $r = 1 - \cos (\theta)$  is $x^4 + y^4 + 2x^2y^2 + 2x^3 + 2xy^2 - y^ 2 = 0$ ?

It is slightly tricky. Multiply through by $r$ and put $r\cos\theta=x$, that gives $r^2=r-x$ or $x=r-r^2$. Squaring and rearranging gives $2r^3=r^4+y^2$. Squaring again gives $4r^6=r^8+2y^2r^4+y^4$. Substituting $r^2=x^2+y^2$ gives a degree 8 polynomial which factors: $(x^4+y^4+2x^2y^2+2x^3+2xy^2-y^2)(x^4+y^4+2x^2y^2-2x^3-2xy^2-y^2)=0$.
So the first question is whether the second factor is valid or whether it is an artefact of all that squaring. Try putting $y=0,x=2$. That fails to satisfy the first factor, but does satisfy the second. It also fails to satisfy the original equation (whereas $y=0,x=-2$ satisfies the first factor and the original equation but not the second factor).
Since the original equation obviously generates a continuous curve, we conclude that we have $x^4+y^4+2x^2y^2+2x^3+2xy^2-y^2=0$ as required.
