We are asked to find $dy/dx$ when $x^y=y^x$. Our hand calculations use logarithmic differentiation.
$$\begin{align*}
x^y&=y^x\\
\ln x^y&=\ln y^x\\
y\ln x&=x\ln y\\
\end{align*}$$
Then we differentiate implicitly both sides with respect to $x$.
$$\begin{align}
y\frac{1}{x}+\frac{dy}{dx}\ln x&=x\frac{1}{y}\frac{dy}{dx}+\ln y\\
\frac{y}{x}+\frac{dy}{dx}\ln x&=\frac{x}{y}\frac{dy}{dx}+\ln y
\end{align}$$
And then we solve for $dy/dx$.
$$\begin{align*}
\left(\ln x-\frac{x}{y}\right)\frac{dy}{dx}&=\ln y-\frac{y}{x}\\
\frac{dy}{dx}&=\frac{\ln y-\dfrac{y}{x}}{\ln x-\dfrac{x}{y}}\\
\frac{dy}{dx}&=\frac{y^2-xy\ln y}{x^2-xy\ln x}
\end{align*}$$
Now, consider the use of Dt
.
Dt[x^y == y^x, x]
The result is:
x^y (y/x + Dt[y, x] Log[x]) == y^x ((x Dt[y, x])/y + Log[y])
Now, note the extra $x^y$ at the beginning of the left-hand side and the extra $y^x$ on the right-hand side. That doesn't compare with our work. To check, we did:
Solve[Dt[x^y == y^x, x], Dt[y, x]]
Which produced:
{{Dt[y, x] -> (y (x^y y - x y^x Log[y]))/(x (x y^x - x^y y Log[x]))}}
Now we tried to compare with our hand-calculated answer.
(y (x^y y - x y^x Log[y]))/(x (x y^x - x^y y Log[x])) == (
x y Log[y] - y^2)/(x y Log[x] - x^2) // FullSimplify
Here's a photo of this last work to make it easier to read:
But we did not get True
. I'm worried about this situation and cannot figure out how to explain this to my students. Any help? Am I missing something?
Update: I so appreciate the help I get on Mathematica Stack Exchange. Here is an example I can now give when teaching logarithmic differentiation. The problem is: $$y=\frac{x^{3/4}\sqrt{1+x^2}}{(2+3x)^5}$$ Students' first step is to take the logarithm of both sides: $$\ln y=\frac{3}{4}\ln x+\frac12 \ln(1+x^2)-5\ln(2+3x)$$ Then differentiate both sides with respect to $x$ to get: $$\frac{dy/dx}{y}=\frac{3}{4x}+\frac{x}{1+x^2}-\frac{15}{2+3x}$$ Now, because of the help I've received, we can do this, which I show to the students in individual steps so that they can understand what is going on.
expandLog = {Log[x_ y_] :> Log[x] + Log[y], Log[x_^n_] :> n Log[x]};
Then:
Thanks for all the wonderful help everyone.