How to solve for y in $y=\text{tanh}(\frac{x}{y})$

algebra-precalculushyperbolic-functions

I want to solve the following equation as a function of purely $x$:

$$y=\text{tanh}\left(\frac{x}{y}\right)$$

My best guess up to this point has been to rearrange the equation using inverse hyperbolic tangent

$$x = y\text{tanh}^{-1}(y)$$

and plugging in the definition for hyperbolic tangent from Wolfram Mathworld

$$\text{tanh}^{-1}(z) = \frac{1}{2}\left[\text{ln}(1+z)-\text{ln}(1-z)\right]$$

Which I've taken as far as

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

But seems like a dead end. Any insight into this problem is super appreciated!

Best Answer

You cannot have an explicit solution for a transcendental equation such as $$y=\text{tanh}\left(\frac{x}{y}\right)$$ Remember that this is already the case for the simpler $y=\cos(y)$.

So, only numerical methods or approximations are possible.

For small values of $x$

Rewriting the equation as $$x=y \tanh ^{-1}(y)=\sum_{n=1}^\infty \frac{y^{2n}}{2n-1}$$ we can truncate the infinite series to some order and inverse it. This would give $$y=\sqrt x \Big[ 1-\frac{x}{6}-\frac{x^2}{360}+\frac{11 x^3}{5040}+\frac{1357 x^4}{1814400}+O\left(x^5\right)\Big] \tag 1$$

Below are some results.

$$\left( \begin{array}{ccc} x & \text{approximation} &\text{solution}\\ 0.00 & 0.000000 & 0.000000 \\ 0.25 & 0.479098 & 0.479098 \\ 0.50 & 0.647916 & 0.647918 \\ 0.75 & 0.757421 & 0.757439 \\ 1.00 & 0.833486 & 0.833557 \\ 1.25 & 0.887065 & 0.887249 \\ 1.50 & 0.924563 & 0.924888 \\ 1.75 & 0.950536 & 0.950841 \\ 2.00 & 0.968711 & 0.968364 \end{array} \right)$$

This seems to be acceptable for rather small values of $x$ (say $x \leq 0.75$). In any manner, for $x > 2.5$, the formula would lead to $y >1$ which is not acceptable.

You could also have some nice approximations using $y_0=\sqrt x$; the first iterate of Newton method is $$y_1=\frac{2 \sqrt{x}+\sinh \left(2 \sqrt{x}\right)}{3+\cosh \left(2 \sqrt{x}\right)} \tag 2$$ which, for sure, is less accurate than the above.

Much better would be to use $y_0=\left(1-\frac{x}{6}\right) \sqrt{x}$ $$y_1=\frac{(x-6) \left((x-6) \tanh \left(\frac{6 \sqrt{x}}{6-x}\right)-6 \sqrt{x} \text{sech}^2\left(\frac{6 \sqrt{x}}{x-6}\right)\right)}{(x-6)^2+36 \text{sech}^2\left(\frac{6 \sqrt{x}}{x-6}\right)}\tag 3$$

Reinjected in the original equation and expanded as series of $x$ around $x=0$, we have for the remainders $$R_{(1)}=\frac{2593 }{11975040}x^{11/2}\qquad R_{(2)}=\frac{1}{36}x^{5/2}\qquad R_{(3)}=\frac{1}{129600}x^{9/2}$$

For large values of $x$

In this case, making the expansion of $$\frac 1 y\text{tanh}\left(\frac{x}{y}\right)$$ around $y=1$, we have $$\tanh (x)+(y-1) \left(-x+x \tanh ^2(x)-\tanh (x)\right)+(y-1)^2 \left(x^2 \tanh ^3(x)-x^2 \tanh (x)+2 x-2 x \tanh ^2(x)+\tanh (x)\right)+O\left((y-1)^3\right)$$ and series reversion leads to $$y=1+\frac{1-\tanh (x)}{-x+x \tanh ^2(x)-\tanh (x)}+$$ $$\frac{(1-\tanh (x))^2 \left(-x^2 \tanh ^3(x)+x^2 \tanh (x)-2 x+2 x \tanh ^2(x)-\tanh (x)\right)}{\left(-x+x \tanh ^2(x)-\tanh (x)\right)^3}+\cdots$$ $$\left( \begin{array}{ccc} x & \text{approximation} &\text{solution}\\ 1 & 0.842391 & 0.833557 \\ 2 & 0.968389 & 0.968364 \\ 3 & 0.995196 & 0.995196 \\ 4 & 0.999333 & 0.999333 \\ 5 & 0.999909 & 0.999909 \\ 6 & 0.999988 & 0.999988 \\ 7 & 0.999998 & 0.999998 \end{array} \right)$$