Notice that
cos(θ) + 2 cos²(θ) + 2 cos³(θ) + cos⁴(θ)
= cos(θ) (1 + 2 cos(θ) + 2 cos²(θ) + cos³(θ))
= cos(θ) ([1 + cos(θ)] + [cos(θ) + cos²(θ)] + [cos²(θ) + cos³(θ)])
= cos(θ) ([1 + cos(θ)] + [cos(θ) (1 + cos(θ))] + [cos²(θ) (1 + cos(θ))])
= cos(θ) (1 + cos(θ)) (1 + cos(θ) + cos²(θ))
Given that sin(θ) = cot(θ), by definition of cotangent this tells us that
sin(θ) = cos(θ)/sin(θ) ⇒ cos(θ) = sin²(θ)
and by the Pythagorean identity
cos²(θ) + sin²(θ) = 1
it follows that
cos(θ) = sin²(θ) = 1 - cos²(θ)
Substituting these results into the factorization above gives
cos(θ) (1 + cos(θ)) (1 + cos(θ) + cos²(θ))
= cos(θ) (1 + cos(θ)) (1 + [1 - cos²(θ)] + cos²(θ))
= 2 cos(θ) (1 + cos(θ))
= 2 sin²(θ) (1 + cos(θ))
= 2 (1 - cos²(θ)) (1 + cos(θ))
= 2 (1 + cos(θ) - cos²(θ) - cos³(θ))
= 2 (cos(θ) + cos(θ) - cos³(θ))
= 2 (2 cos(θ) - cos³(θ))
= 2 cos(θ) (2 - cos²(θ))
= 2 cos(θ) (1 + cos(θ))
= 2 (cos(θ) + cos²(θ))
= 2 (1 - cos²(θ) + cos²(θ))
= 2