# How to convert the solution of this recurrence like this form?

I am trying to solve the recurrence sequence. I tried

RSolve[{a[n] == 1/2 (a[n - 1] + 9/a[n - 1]), a == 1}, a[n],
n] // Simplify


I got

{{a[n] -> 3 Coth[2^(-1 + n) ArcCoth[1/3]]}}

How to convert this solution to this form

(3*2^(2^(-1 + n)) + 3)/(2^(2^(-1 + n)) - 1)

• This is not possible for these are entirely different number. One has $a(n) \to 0$ for $n \to \infty$, but $(3 (49 + 49^n))/(-49 + 49^n) \to 3$. – Henrik Schumacher Sep 30 '18 at 10:33
• They are not equal at n=2 for instance. – b.gates.you.know.what Sep 30 '18 at 10:35
• I just realized that the solution $a(n)$ given by Mathematica does not fulfill the recurrence relation... – Henrik Schumacher Sep 30 '18 at 10:36
• @b.gatessucks Edited. – minhthien_2016 Sep 30 '18 at 10:42

A way:

sol = a[n] /. RSolve[{a[n] == 1/2 (a[n - 1] + 9/a[n - 1]), a == 1}, a[n],n][[1, 1]]
FullSimplify[sol // TrigToExp // ComplexExpand, Assumptions -> {n > 1, n \[Element] Integers}] // Factor


$$\frac{3 \left(2^{2^{n-1}}+1\right)}{2^{2^{n-1}}-1}$$

sol = RSolve[{a[n] == 1/2 (a[n - 1] + 9/a[n - 1]), a == 1}, a[n],n][[1, 1]];

Note that your second expression has the wrong limiting value for n=1. This may make it harder to find an automatic transformation.