# Differentiate the function with respect to x.

Question:

Differentiate the function with respect to x.

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

Solution:

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

Also, let $u=\left(x+\frac{1}{x}\right)^{x}$ and $v=x^{\left(1+\frac{1}{x}\right)}$

$\therefore y=u+v$

$\Rightarrow \frac{d y}{d x}=\frac{d u}{d x}+\frac{d v}{d x}$   ...(1)

Then, $u=\left(x+\frac{1}{x}\right)^{x}$

$\Rightarrow \log u=\log \left(x+\frac{1}{x}\right)^{x}$

$\Rightarrow \log u=x \log \left(x+\frac{1}{x}\right)$

Differentiating both sides with respect to x, we obtain

$\frac{1}{u} \cdot \frac{d u}{d x}=\frac{d}{d x}(x) \times \log \left(x+\frac{1}{x}\right)+x \times \frac{d}{d x}\left[\log \left(x+\frac{1}{x}\right)\right]$

$\Rightarrow \frac{1}{u} \frac{d u}{d x}=1 \times \log \left(x+\frac{1}{x}\right)+x \times \frac{1}{\left(x+\frac{1}{x}\right)} \cdot \frac{d}{d x}\left(x+\frac{1}{x}\right)$

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

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

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

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

$v=x^{\left(1+\frac{1}{x}\right)}$

$\Rightarrow \log v=\log \left[x^{\left(1+\frac{1}{x}\right)}\right]$

$\Rightarrow \log v=\left(1+\frac{1}{x}\right) \log x$

Differentiating both sides with respect to x, we obtain

$\frac{1}{v} \cdot \frac{d v}{d x}=\left[\frac{d}{d x}\left(1+\frac{1}{x}\right)\right] \times \log x+\left(1+\frac{1}{x}\right) \cdot \frac{d}{d x} \log x$

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

$\Rightarrow \frac{1}{v} \frac{d v}{d x}=-\frac{\log x}{x^{2}}+\frac{1}{x}+\frac{1}{x^{2}}$

$\Rightarrow \frac{d v}{d x}=v\left[\frac{-\log x+x+1}{x^{2}}\right]$

$\Rightarrow \frac{d v}{d x}=x^{\left(1+\frac{1}{x}\right)}\left(\frac{x+1-\log x}{x^{2}}\right)$   ...(3)

Therefore, from (1), (2), and (3), we obtain

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