# How do you differentiate g(x) = (2sinx -e^x) ( cosx-x^2) using the product rule?

$g ' \left(x\right) = 2 {\cos}^{2} \left(x\right) - {e}^{x} \cos \left(x\right) - 2 {x}^{2} \cos \left(x\right) + {x}^{2} {e}^{x} - 2 {\sin}^{2} \left(x\right) + {e}^{x} \sin \left(x\right) - 4 x \sin \left(x\right) + 2 x {e}^{x}$
$g ' \left(x\right) = \left(2 \cos \left(x\right) - {e}^{x}\right) \left(\cos \left(x\right) - {x}^{2}\right) + \left(2 \sin \left(x\right) - {e}^{x}\right) \left(- \sin \left(x\right) - 2 x\right)$