I am having two problems regarding Mathematica, and both of them are happening because it does not accept such inputs:

RSolve[ g[n + 1] == g[n]^2 + 2*f[n]^2, f[n + 1] == 2f[n]*g[n]]


RSolve[ g[n + 1] == g[n]^2 + sum[ f[n - 1, i], i = 0..n-1], f[n,x]== (n!)/((x!)*(n-x)!)]

And I have no idea how to provide the correct input for such equations that Mathematica understands.

  • $\begingroup$ You are missing an n argument. There are examples in help reference.wolfram.com/mathematica/ref/RSolve.html $\endgroup$
    – Nasser
    Nov 16, 2013 at 12:46
  • $\begingroup$ Also, the correct syntax for Sum is Sum[expr,{i,0,n-1}] $\endgroup$
    – Peltio
    Nov 16, 2013 at 12:48
  • $\begingroup$ If you wish getting helpful answers you should provide a bit more constructive question. First improve it by rewriting the code involving acceptable syntax. However in the case of your equations I suggest to start playing with RecurrenceTable or imposing appropriate initial/boundary conditions e.g. f[0] == 1/3 && g[0] == 1/2. $\endgroup$
    – Artes
    Nov 16, 2013 at 13:51
  • 2
    $\begingroup$ @lkn2993 You should correct the syntax in the question, then perhaps someone finds your problem interesting to solve it. I suggested to try finding appropriate initial conditions as well. $\endgroup$
    – Artes
    Nov 16, 2013 at 15:26
  • 1
    $\begingroup$ From my reading of the documentation RSolve will not accept nonlinear equations in two or more variables. What little experimentation I've done tends to confirm this. $\endgroup$
    – m_goldberg
    Nov 17, 2013 at 0:19

1 Answer 1



In the following the role of f and g have been inadvertently exchanged,i.e.

$f(n)=f(n-1)^2+2 g(n-1)^2$ and $g(n)=2 f(n-1)g(n-1)$

Therefore, just exchange.

The values can be obtained by defining the recursive functions with suitable starting values for f and g. I present alternatives.

It is relatively straightforward to uncouple the relations: $h(n)=f(n)+\sqrt{2}g(n)$ and $j(n)=f(n)-\sqrt{2}g(n)$ the recurrence then becomes:



then the solutions are:



then solving by back substitution.

For example, f(0)=g(0)=1 yields (for $n\geq1$:

$f(n)= (1+\sqrt{2})^{2^n}+(1-\sqrt{2})^{2^n}$

$g(n)= \frac{(1+\sqrt{2})^{2^n}-(1-\sqrt{2})^{2^n}}{2\sqrt{2}}$

You can also solve and tabulate as follows:


To tabulate first 5 results (and initial conditions):

TableForm[r[5], TableHeadings -> {Range[6] - 1, {f[n], g[n]}}]

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.