Choose the correct alternative in the following:
If $y=\left(1+\frac{1}{x}\right)^{x}$, then $\frac{d y}{d x}=$
A. $\left(1+\frac{1}{x}\right)^{x}\left\{\log \left(1+\frac{1}{x}\right)-\frac{1}{x+1}\right\}$
B. $\left(1+\frac{1}{x}\right)^{x} \log \left(1+\frac{1}{x}\right)$
C. $\left(1+\frac{1}{x}\right)^{x}\left\{\log (x+1)-\frac{x}{x+1}\right\}$
D. $\left(1+\frac{1}{x}\right)^{x}\left\{\log \left(x+\frac{1}{x}\right)+\frac{1}{x+1}\right\}$
Given $y=\left(1+\frac{1}{x}\right)^{x}$
Taking log both sides we get
$\Rightarrow \log y=\log \left(1+\frac{1}{x}\right)^{x}$
$\Rightarrow \log y=x \cdot \log \left(1+\frac{1}{x}\right)$
Differentiating w.r.t $x$ we get,
$\Rightarrow \frac{1}{y} \frac{d y}{d x}=1 \cdot \log \left(1+\frac{1}{x}\right)+\frac{1}{1+\frac{1}{x}} \cdot\left(-\frac{1}{x^{2}}\right) \cdot x$
$\Rightarrow \frac{d y}{d x}=y\left(\log \left(1+\frac{1}{x}\right)+\frac{x}{x+1} \cdot\left(-\frac{1}{x}\right)\right)$
Putting value of $y$, we get
$\Rightarrow \frac{\mathrm{dy}}{\mathrm{dx}}=\left(1+\frac{1}{\mathrm{x}}\right)^{\mathrm{x}}\left(\log \left(1+\frac{1}{\mathrm{x}}\right)-\frac{1}{\mathrm{x}+1}\right)$