First, we write the right hand side as:
y = 2x sin x + (2 − x2) cos x.
We have 2 products. The first term is the product of (2x) and (sin x). The second term is the product of (2 - x2) and (cos x).
So, using the Product Rule on both terms gives us: