# What is a simpler method to find the analytical expression for the function f[x]?

Given the following conditions, find the analytical expression for the function f[x]

f[Sqrt[x] + 1/Sqrt[x]] == x + 1/x


My method is as follows:

Reduce[Sqrt[x] + 1/Sqrt[x] == t && t >= 2 && x > 0, x]

(t == 2 &&
x == 1) || (t >
2 && (x == 1/2 (-2 + t^2) - 1/2 Sqrt[-4 t^2 + t^4] ||
x == 1/2 (-2 + t^2) + 1/2 Sqrt[-4 t^2 + t^4]))

1/(1/2  (-2 + t^2) - 1/2  Sqrt[-4 t^2 + t^4]) + 1/2  (-2 + t^2) -
1/2  Sqrt[-4 t^2 + t^4] // Simplify

-2 + t^2



And this method also cannot directly yield the analytical expression for f[x]

RSolve[{f[Sqrt[x] + 1/Sqrt[x]] == x + 1/x, f[2] == 2}, f[x], x]

• (-1) You're using RSolve blindly. Commented Jul 24 at 6:46

Eliminate[{f == x + 1/x, t == Sqrt[x] + 1/Sqrt[x]}, x]
(*    t^2 == 2 + f    *)


from which $$f(t)=t^2-2$$ follows immediately with Solve[%, f].

Or, with some branch warnings (and thus less safe),

Solve[{f == x + 1/x, t == Sqrt[x] + 1/Sqrt[x]}, {f, x}]
(*    {{f -> -2 + t^2, x -> 1/2 (-2 + t^2 - t Sqrt[-4 + t^2])},
{f -> -2 + t^2, x -> 1/2 (-2 + t^2 + t Sqrt[-4 + t^2])}}    *)


Simplify your equation by replacing x by x^2:

f[x + 1/x] == x^2 + 1/x^2


Then we replace the argument of f by y== x + 1/x and solve for x:

sol=Solve[y == x + 1/x, x]

{{x -> 1/2 (y - Sqrt[-4 + y^2])}, {x -> 1/2 (y + Sqrt[-4 + y^2])}}


With this we get an analytic functions:

{f1[y_], f2[y_]} = x^2 + 1/x^2 /. sol // Simplify

{-2 + y^2, -2 + y^2}


As both functions are identical:

fres[y_]= -2+y^2


To check if this is correct:

fres[Sqrt[x] + 1/Sqrt[x]] // Simplify

1/x + x


From general solution to specific:

Quiet[
sol = Solve[Eliminate[{f[g[x]] == h[x], t == g[x]}, x], f[t]];
Block[{g = x |-> Sqrt[x] + 1/Sqrt[x], h = x |-> x + 1/x},
sol // Simplify],
{InverseFunction::ifun, Solve::ifun}]
(*  {{f[t] -> -2 + t^2}}  *)


I would like to stress here the fact that a functional equation like this one :

$$f(x+1/x)=x^2+1/x^2 \ (\text{with} \ x > 0) \tag{1}$$

can be solved without needing any software in the following manner.

Setting $$x=e^{u}$$, (1) can be written :

$$f(2 \cosh u)=\cosh 2u \tag{2}$$

Otherwise said, setting $$v=2 \cosh u \iff u=\operatorname{arcosh}(v/2)$$ :

$$f(v)=\cosh(2 \operatorname{arcosh}(v/2)$$

where we recognize a conjugation relation : $$f=h \circ g \circ h^{-1}$$