Find the derivative of LaTeX:  \displaystyle y = \frac{\left(- 9 x - 6\right)^{2} \left(7 x + 1\right)^{3} e^{x}}{\left(x + 2\right)^{4} \cos^{6}{\left(x \right)}}

Taking the natural logarithm of both sides of the equation and expanding the right hand side gives: LaTeX:  \ln(y) = \ln{\left(\frac{\left(- 9 x - 6\right)^{2} \left(7 x + 1\right)^{3} e^{x}}{\left(x + 2\right)^{4} \cos^{6}{\left(x \right)}} \right)}   Expanding the right hand side using the product and quotient properties of logarithms gives: LaTeX:  \ln(y) = x + 2 \ln{\left(- 9 x - 6 \right)} + 3 \ln{\left(7 x + 1 \right)}- 4 \ln{\left(x + 2 \right)} - 6 \ln{\left(\cos{\left(x \right)} \right)}   Taking the derivative on both sides of the equation yields: LaTeX:  \frac{y'}{y} = \frac{6 \sin{\left(x \right)}}{\cos{\left(x \right)}} + 1 + \frac{21}{7 x + 1} - \frac{4}{x + 2} - \frac{18}{- 9 x - 6}   Solving for LaTeX:  \displaystyle y' and substituting out y using the original equation gives LaTeX:  y' = \left(\frac{6 \sin{\left(x \right)}}{\cos{\left(x \right)}} + 1 + \frac{21}{7 x + 1} - \frac{4}{x + 2} - \frac{18}{- 9 x - 6}\right)\left(\frac{\left(- 9 x - 6\right)^{2} \left(7 x + 1\right)^{3} e^{x}}{\left(x + 2\right)^{4} \cos^{6}{\left(x \right)}} \right)   Using some Trigonometric identities to simplify gives LaTeX:  y' = \left(1 + \frac{21}{7 x + 1} - \frac{18}{- 9 x - 6}6 \tan{\left(x \right)} - \frac{4}{x + 2}\right)\left(\frac{\left(- 9 x - 6\right)^{2} \left(7 x + 1\right)^{3} e^{x}}{\left(x + 2\right)^{4} \cos^{6}{\left(x \right)}} \right)