# Differentiate the following functions with respect to x :

Question:

Differentiate the following functions with respect to $x$ :

$\log \left(\frac{x^{2}+x+1}{x^{2}-x+1}\right)$

Solution:

Let $y=\log \left(\frac{x^{2}+x+1}{x^{2}-x+1}\right)$

On differentiating y with respect to $x$, we get

$\frac{\mathrm{dy}}{\mathrm{dx}}=\frac{\mathrm{d}}{\mathrm{dx}}\left[\log \left(\frac{\mathrm{x}^{2}+\mathrm{x}+1}{\mathrm{x}^{2}-\mathrm{x}+1}\right)\right]$

We know $\frac{\mathrm{d}}{\mathrm{dx}}(\log \mathrm{x})=\frac{1}{\mathrm{x}}$

$\Rightarrow \frac{d y}{d x}=\frac{1}{\left(\frac{x^{2}+x+1}{x^{2}-x+1}\right)} \frac{d}{d x}\left(\frac{x^{2}+x+1}{x^{2}-x+1}\right)$ [using chain rule]

$\Rightarrow \frac{\mathrm{dy}}{\mathrm{dx}}=\left(\frac{\mathrm{x}^{2}-\mathrm{x}+1}{\mathrm{x}^{2}+\mathrm{x}+1}\right) \frac{\mathrm{d}}{\mathrm{dx}}\left(\frac{\mathrm{x}^{2}+\mathrm{x}+1}{\mathrm{x}^{2}-\mathrm{x}+1}\right)$

Recall that $\left(\frac{\mathrm{u}}{\mathrm{v}}\right)^{\prime}=\frac{\mathrm{vu}^{\prime}-\mathrm{uv}^{\prime}}{\mathrm{v}^{2}}$ (quotient rule)

$\Rightarrow \frac{\mathrm{dy}}{\mathrm{dx}}$

$=\left(\frac{x^{2}-x+1}{x^{2}+x+1}\right)\left[\frac{\left(x^{2}-x+1\right) \frac{d}{d x}\left(x^{2}+x+1\right)-\left(x^{2}+x+1\right) \frac{d}{d x}\left(x^{2}-x+1\right)}{\left(x^{2}-x+1\right)^{2}}\right]$

$\Rightarrow \frac{\mathrm{dy}}{\mathrm{dx}}$

$=\left(\frac{x^{2}-x+1}{x^{2}+x+1}\right)\left[\frac{\left(x^{2}-x+1\right)\left(\frac{d}{d x}\left(x^{2}\right)+\frac{d}{d x}(x)+\frac{d}{d x}(1)\right)-\left(x^{2}+x+1\right)\left(\frac{d}{d x}\left(x^{2}\right)-\frac{d}{d x}(x)+\frac{d}{d x}(1)\right)}{\left(x^{2}-x+1\right)^{2}}\right]$

We know $\frac{\mathrm{d}}{\mathrm{dx}}\left(\mathrm{x}^{2}\right)=2 \mathrm{x}, \frac{\mathrm{d}}{\mathrm{dx}}(\mathrm{x})=1$ and derivative of constant is 0 .

$\Rightarrow \frac{d y}{d x}=\left(\frac{x^{2}-x+1}{x^{2}+x+1}\right)\left[\frac{\left(x^{2}-x+1\right)(2 x+1+0)-\left(x^{2}+x+1\right)(2 x-1+0)}{\left(x^{2}-x+1\right)^{2}}\right]$

$\Rightarrow \frac{\mathrm{dy}}{\mathrm{dx}}=\left(\frac{\mathrm{x}^{2}-\mathrm{x}+1}{\mathrm{x}^{2}+\mathrm{x}+1}\right)\left[\frac{(2 \mathrm{x}+1)\left(\mathrm{x}^{2}-\mathrm{x}+1\right)-(2 \mathrm{x}-1)\left(\mathrm{x}^{2}+\mathrm{x}+1\right)}{\left(\mathrm{x}^{2}-\mathrm{x}+1\right)^{2}}\right]$

$\Rightarrow \frac{\mathrm{dy}}{\mathrm{dx}}$

$=\left(\frac{x^{2}-x+1}{x^{2}+x+1}\right)\left[\frac{2 x\left(x^{2}-x+1\right)+\left(x^{2}-x+1\right)-2 x\left(x^{2}+x+1\right)+\left(x^{2}+x+1\right)}{\left(x^{2}-x+1\right)^{2}}\right]$

$\Rightarrow \frac{d y}{d x}$

$=\left(\frac{x^{2}-x+1}{x^{2}+x+1}\right)\left[\frac{2 x\left(x^{2}-x+1-x^{2}-x-1\right)+\left(x^{2}-x+1+x^{2}+x+1\right)}{\left(x^{2}-x+1\right)^{2}}\right]$

$\Rightarrow \frac{d y}{d x}=\left(\frac{x^{2}-x+1}{x^{2}+x+1}\right)\left[\frac{2 x(-2 x)+\left(2 x^{2}+2\right)}{\left(x^{2}-x+1\right)^{2}}\right]$

$\Rightarrow \frac{d y}{d x}=\left(\frac{x^{2}-x+1}{x^{2}+x+1}\right)\left[\frac{-4 x^{2}+2 x^{2}+2}{\left(x^{2}-x+1\right)^{2}}\right]$

$\Rightarrow \frac{d y}{d x}=\left(\frac{x^{2}-x+1}{x^{2}+x+1}\right)\left[\frac{2-2 x^{2}}{\left(x^{2}-x+1\right)^{2}}\right]$

$\Rightarrow \frac{d y}{d x}=\frac{2-2 x^{2}}{\left(x^{2}+x+1\right)\left(x^{2}-x+1\right)}$

$\Rightarrow \frac{\mathrm{dy}}{\mathrm{dx}}=\frac{2\left(1-\mathrm{x}^{2}\right)}{\left(\mathrm{x}^{2}+1\right)^{2}-\mathrm{x}^{2}}$

$\Rightarrow \frac{\mathrm{dy}}{\mathrm{dx}}=\frac{2\left(1-\mathrm{x}^{2}\right)}{\left(\mathrm{x}^{2}+1\right)^{2}-\mathrm{x}^{2}}$

$\Rightarrow \frac{\mathrm{dy}}{\mathrm{dx}}=\frac{2\left(1-\mathrm{x}^{2}\right)}{\mathrm{x}^{4}+2 \mathrm{x}^{2}+1-\mathrm{x}^{2}}$

$\therefore \frac{\mathrm{dy}}{\mathrm{dx}}=\frac{2\left(1-\mathrm{x}^{2}\right)}{\mathrm{x}^{4}+\mathrm{x}^{2}+1}$

Thus, $\frac{d}{d x}\left[\log \left(\frac{x^{2}+x+1}{x^{2}-x+1}\right)\right]=\frac{2\left(1-x^{2}\right)}{x^{4}+x^{2}+1}$