Product rule trig This was given as a solution to a question and I've tried working it out but can never get the same answer. Here $x=rcosϕ$ and $y=rsinϕ$

It's mostly the first 2 lines I don't understand. Wouldn't $x^2 = r^2cos^2ϕ$ and $y^2 = r^2sin^2ϕ$? And how did the first 2 terms of the second line come along? I can understand the last 2 terms from the product rule but not the beginning...

$$\ r^2d\phi=r^2\cdot1\cdot d\phi=r^2\cdot(\cos^2(\phi)+\sin^2(\phi))\cdot d\phi=$$
$$\ =r^2\cos^2(\phi)d\phi+r^2\sin^2(\phi)d\phi=r\cos(\phi) r\cos(\phi)d\phi+r\cos(\phi) r\cos(\phi)d\phi$$
Now you have that:
$$\ r\cos(\phi)=x$$
and
$$d(r\sin(\phi))=\sin(\phi)dr+rd(\sin(\phi))=\sin(\phi)dr+r\cos(\phi)d\phi$$
$$d(r\cos(\phi))=\cos(\phi)dr-r\sin(\phi)d\phi$$
so you get
$$\ r\cos(\phi)d\phi=d(r\sin(\phi))-\sin(\phi)dr$$
$$\ r\sin(\phi)d\phi=\cos(\phi)dr-d(r\cos(\phi))$$
