# Derivative of $x^{2} \sin{\left(x \right)}$

The calculator will find the derivative of $x^{2} \sin{\left(x \right)}$ using the logarithmic differentiation, with steps shown.

Related calculator: Derivative Calculator

Leave empty for autodetection.
Leave empty, if you don't need the derivative at a specific point.

If the calculator did not compute something or you have identified an error, or you have a suggestion/feedback, please write it in the comments below.

Find $\frac{d}{dx} \left(x^{2} \sin{\left(x \right)}\right)$.

### Solution

Let $H{\left(x \right)} = x^{2} \sin{\left(x \right)}$.

Take the logarithm of both sides: $\ln\left(H{\left(x \right)}\right) = \ln\left(x^{2} \sin{\left(x \right)}\right)$.

Rewrite the RHS using the properties of logarithms: $\ln\left(H{\left(x \right)}\right) = 2 \ln\left(x\right) + \ln\left(\sin{\left(x \right)}\right)$.

Differentiate separately both sides of the equation: $\frac{d}{dx} \left(\ln\left(H{\left(x \right)}\right)\right) = \frac{d}{dx} \left(2 \ln\left(x\right) + \ln\left(\sin{\left(x \right)}\right)\right)$.

Differentiate the LHS of the equation.

The function $\ln\left(H{\left(x \right)}\right)$ is the composition $f{\left(g{\left(x \right)} \right)}$ of two functions $f{\left(u \right)} = \ln\left(u\right)$ and $g{\left(x \right)} = H{\left(x \right)}$.

Apply the chain rule $\frac{d}{dx} \left(f{\left(g{\left(x \right)} \right)}\right) = \frac{d}{du} \left(f{\left(u \right)}\right) \frac{d}{dx} \left(g{\left(x \right)}\right)$:

$${\color{red}\left(\frac{d}{dx} \left(\ln\left(H{\left(x \right)}\right)\right)\right)} = {\color{red}\left(\frac{d}{du} \left(\ln\left(u\right)\right) \frac{d}{dx} \left(H{\left(x \right)}\right)\right)}$$

The derivative of the natural logarithm is $\frac{d}{du} \left(\ln\left(u\right)\right) = \frac{1}{u}$:

$${\color{red}\left(\frac{d}{du} \left(\ln\left(u\right)\right)\right)} \frac{d}{dx} \left(H{\left(x \right)}\right) = {\color{red}\left(\frac{1}{u}\right)} \frac{d}{dx} \left(H{\left(x \right)}\right)$$

$$\frac{\frac{d}{dx} \left(H{\left(x \right)}\right)}{{\color{red}\left(u\right)}} = \frac{\frac{d}{dx} \left(H{\left(x \right)}\right)}{{\color{red}\left(H{\left(x \right)}\right)}}$$

Thus, $\frac{d}{dx} \left(\ln\left(H{\left(x \right)}\right)\right) = \frac{\frac{d}{dx} \left(H{\left(x \right)}\right)}{H{\left(x \right)}}$.

Differentiate the RHS of the equation.

The derivative of a sum/difference is the sum/difference of derivatives:

$${\color{red}\left(\frac{d}{dx} \left(2 \ln\left(x\right) + \ln\left(\sin{\left(x \right)}\right)\right)\right)} = {\color{red}\left(\frac{d}{dx} \left(2 \ln\left(x\right)\right) + \frac{d}{dx} \left(\ln\left(\sin{\left(x \right)}\right)\right)\right)}$$

The function $\ln\left(\sin{\left(x \right)}\right)$ is the composition $f{\left(g{\left(x \right)} \right)}$ of two functions $f{\left(u \right)} = \ln\left(u\right)$ and $g{\left(x \right)} = \sin{\left(x \right)}$.

Apply the chain rule $\frac{d}{dx} \left(f{\left(g{\left(x \right)} \right)}\right) = \frac{d}{du} \left(f{\left(u \right)}\right) \frac{d}{dx} \left(g{\left(x \right)}\right)$:

$${\color{red}\left(\frac{d}{dx} \left(\ln\left(\sin{\left(x \right)}\right)\right)\right)} + \frac{d}{dx} \left(2 \ln\left(x\right)\right) = {\color{red}\left(\frac{d}{du} \left(\ln\left(u\right)\right) \frac{d}{dx} \left(\sin{\left(x \right)}\right)\right)} + \frac{d}{dx} \left(2 \ln\left(x\right)\right)$$

The derivative of the natural logarithm is $\frac{d}{du} \left(\ln\left(u\right)\right) = \frac{1}{u}$:

$${\color{red}\left(\frac{d}{du} \left(\ln\left(u\right)\right)\right)} \frac{d}{dx} \left(\sin{\left(x \right)}\right) + \frac{d}{dx} \left(2 \ln\left(x\right)\right) = {\color{red}\left(\frac{1}{u}\right)} \frac{d}{dx} \left(\sin{\left(x \right)}\right) + \frac{d}{dx} \left(2 \ln\left(x\right)\right)$$

$$\frac{d}{dx} \left(2 \ln\left(x\right)\right) + \frac{\frac{d}{dx} \left(\sin{\left(x \right)}\right)}{{\color{red}\left(u\right)}} = \frac{d}{dx} \left(2 \ln\left(x\right)\right) + \frac{\frac{d}{dx} \left(\sin{\left(x \right)}\right)}{{\color{red}\left(\sin{\left(x \right)}\right)}}$$

The derivative of the sine is $\frac{d}{dx} \left(\sin{\left(x \right)}\right) = \cos{\left(x \right)}$:

$$\frac{d}{dx} \left(2 \ln\left(x\right)\right) + \frac{{\color{red}\left(\frac{d}{dx} \left(\sin{\left(x \right)}\right)\right)}}{\sin{\left(x \right)}} = \frac{d}{dx} \left(2 \ln\left(x\right)\right) + \frac{{\color{red}\left(\cos{\left(x \right)}\right)}}{\sin{\left(x \right)}}$$

Apply the constant multiple rule $\frac{d}{dx} \left(c f{\left(x \right)}\right) = c \frac{d}{dx} \left(f{\left(x \right)}\right)$ with $c = 2$ and $f{\left(x \right)} = \ln\left(x\right)$:

$${\color{red}\left(\frac{d}{dx} \left(2 \ln\left(x\right)\right)\right)} + \frac{\cos{\left(x \right)}}{\sin{\left(x \right)}} = {\color{red}\left(2 \frac{d}{dx} \left(\ln\left(x\right)\right)\right)} + \frac{\cos{\left(x \right)}}{\sin{\left(x \right)}}$$

The derivative of the natural logarithm is $\frac{d}{dx} \left(\ln\left(x\right)\right) = \frac{1}{x}$:

$$2 {\color{red}\left(\frac{d}{dx} \left(\ln\left(x\right)\right)\right)} + \frac{\cos{\left(x \right)}}{\sin{\left(x \right)}} = 2 {\color{red}\left(\frac{1}{x}\right)} + \frac{\cos{\left(x \right)}}{\sin{\left(x \right)}}$$

Simplify:

$$\frac{\cos{\left(x \right)}}{\sin{\left(x \right)}} + \frac{2}{x} = \frac{\frac{x}{\tan{\left(x \right)}} + 2}{x}$$

Thus, $\frac{d}{dx} \left(2 \ln\left(x\right) + \ln\left(\sin{\left(x \right)}\right)\right) = \frac{\frac{x}{\tan{\left(x \right)}} + 2}{x}$.

Hence, $\frac{\frac{d}{dx} \left(H{\left(x \right)}\right)}{H{\left(x \right)}} = \frac{\frac{x}{\tan{\left(x \right)}} + 2}{x}$.

Therefore, $\frac{d}{dx} \left(H{\left(x \right)}\right) = \frac{\left(\frac{x}{\tan{\left(x \right)}} + 2\right) H{\left(x \right)}}{x} = x \left(x \cos{\left(x \right)} + 2 \sin{\left(x \right)}\right)$.

$\frac{d}{dx} \left(x^{2} \sin{\left(x \right)}\right) = x \left(x \cos{\left(x \right)} + 2 \sin{\left(x \right)}\right)$A