I was calculating a very simple derivative of
$$ f(x) = x^2-\frac{1}{X^2} $$
and my result is
$$ f^{\prime}(x) = 2x + \frac{2}{x^3} $$
But I can't explain why WolframAlpha says the result is $2x$. It asserts that
The derivative of $-\frac{1}{X^2}$ is zero thus $ = 2x+0$
However, when you ask it to compute the derivative of $-\frac{1}{X^2}$ alone, the result is $\frac{2}{X^3}$ as expected. Is there something I'm missing?
Here's my full solution.
$$\begin{aligned} f^{\prime}(x) = &2x-(x^{-2})^{\prime} \\ =&2x-(-2x^{-3}) \\ =&2x+2x^{-3} \\ =&2x+\frac{2}{x^3}. \end{aligned}$$
When you specify an expression for $f(x)$ and take the derivative, all other variables apart from $x$ are considered constants. Here, $X$ is such a constant that must not be confused with $x$.
When you submit the expression $\frac1{X^2}$ instead, there is only one variable ocurring on the expression andWolframAlpha tacitly assumes that you want to take the derivative with respect to that (i.e. apply the operator $\frac {\mathrm d}{\mathrm d X}$ and not $\frac {\mathrm d}{\mathrm d x}$).