Prove the trigonometric identity below. Show all steps of your algebraic solution for full marks

(x sin (theta) - y cos (theta) )^2 + (x cos (theta) + y sin (theta) )^2 = x^2 + y^2

mathhelper did this a while ago, using the clever idea of having

x = cosØ
y = sinØ
so that the equation becomes
(cosØ sinθ - sinØ cosθ)^2 + (cosØ cosθ + sinØ sinθ)^2
= sin(θ-Ø)^2 + cos(θ-Ø)^2 = 1 = x^2+y^2
Of course, that only works if |x| and |y| are at most 1.

Otherwise, you need to do all the algebra first.
(xsinθ - ycosθ)^2 = x^2 sin^2θ - 2xy sinθ cosθ + y^2 cos^2θ
and similarly with (xcosθ-ysinθ)^2
all the sinθ cosθ terms cancel, and you are left with a lot of (sin^2θ+cos^2θ) terms which are just 1.

Remark, use identities:

( a - b )² = a² - 2 ∙ a ∙ b + b²

( a + b )² = a² + 2 ∙ a ∙ b + b²
______________________

( x sin θ - y cos θ )² + ( x cos θ + y sin θ )² =

( x sin θ )² - 2 ∙ x sin θ ∙ y ∙ cos θ + ( y cos θ )² + ( x cos θ )² + 2 ∙ x cos θ ∙ y ∙ sin θ + ( y sin θ )² =

( x sin θ )² - 2 ∙ x sin θ ∙ y ∙ cos θ + ( y cos θ )² + ( x cos θ )² + 2 ∙ x sin θ ∙ y ∙ cos θ + ( y sin θ )² =

( x sin θ )² + ( y cos θ )² + ( x cos θ )² + ( y sin θ )² =

x² sin² θ + y² cos² θ + x² cos² θ + y² sin² θ =

x² ( sin² θ + cos² θ ) + y² ( cos² θ + sin² θ ) = x² ∙ 1 + y² ∙ 1 = x² + y²

To prove the trigonometric identity (x sin(theta) - y cos(theta))^2 + (x cos(theta) + y sin(theta))^2 = x^2 + y^2, we will expand both sides and show that they are equal.

Let's start by expanding the left side of the equation:
(x sin(theta) - y cos(theta))^2 + (x cos(theta) + y sin(theta))^2

Using the identity (a - b)^2 = a^2 - 2ab + b^2, we can expand the first term:
= (x^2 sin^2(theta) - 2xy sin(theta) cos(theta) + y^2 cos^2(theta))

Using the identity (a + b)^2 = a^2 + 2ab + b^2, we can expand the second term:
+ (x^2 cos^2(theta) + 2xy sin(theta) cos(theta) + y^2 sin^2(theta))

Now, let's simplify the expanded equation:
= x^2 sin^2(theta) - 2xy sin(theta) cos(theta) + y^2 cos^2(theta) + x^2 cos^2(theta) + 2xy sin(theta) cos(theta) + y^2 sin^2(theta)

Notice that the terms - 2xy sin(theta) cos(theta) and + 2xy sin(theta) cos(theta) cancel out, as they have opposite signs. We are left with:
= x^2 sin^2(theta) + y^2 cos^2(theta) + x^2 cos^2(theta) + y^2 sin^2(theta)

Using the trigonometric identity sin^2(theta) + cos^2(theta) = 1, we can simplify further:
= x^2 (sin^2(theta) + cos^2(theta)) + y^2 (cos^2(theta) + sin^2(theta))

And applying the identity again, we have:
= x^2 (1) + y^2 (1)

Which simplifies to:
= x^2 + y^2

Therefore, we have proven that (x sin(theta) - y cos(theta))^2 + (x cos(theta) + y sin(theta))^2 = x^2 + y^2, as desired.