Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to solve functional equations in Mathematica, but got nowhere. Just a simple example: $$f(x+y)^2=f(x)^2+f(y)^2$$ for all $x,y \in R$, assuming f is a real-valued function.

How should I approach this problem in Mathematica ?

share|improve this question
RSolve is supposed to be able to solve functional equations, but I could not use it on the above, may be I am not setting it up right. But you can google RSolve in documentaion center, they have some examples. – Nasser Aug 28 '13 at 16:29
@Nasser where do you see that? I only see that it is capable of solving difference equations. – rcollyer Aug 28 '13 at 16:35
@rcollyer, it said : Solve a functional equation: and the OP is asking for Solve a functional equation So, I simply posted a link. I did not say it can do the one being asked for or not. It is right there on the page, down near the last example. May be the terminology is not clear. – Nasser Aug 28 '13 at 16:38
@Nasser I see it now. My mistake. Likely, it can only be used in some special cases as I don't see much in the way of further discussion on the topic. – rcollyer Aug 28 '13 at 16:44

At first we should try to envision what kind of function it might be. We need no computer system for that. So let's start with assumptons: $f$ is a real valued function on the real domain. Therefore we have: $$ f(x+0)^2=f(x)^2+f(0)^2$$ thus $$ f(0)=0$$ Then $$f(x-x)^2=f(x)^2+f(-x)^2$$ it implies $$0=f(x)^2+f(-x)^2$$ Sum of two non-negative numbers is zero ($f$ is real valued function), therefore for all $x$ $$f(x)=0$$

We need no Mathematica functionality for this conclusion.


Assuming that we need certain functions of the system the problem is more involved and can be analyzed on a case by case basis. At first, basically it depends on the functional relations to be solved. Then we should choose appropriately the class of functions where we can search for solutions.
Although mathematically speaking the above problem is quite simple it appears to be much more difficult for computer systems when no assumption on class of functions is given.

Assuming, that we are looking for polynomial functions there is e.g. SolveAlways working nicely for lower order polynomials. It finds however many dulicates (in our case) of the same solutions and for this reason it couldn't work directly for higher order polynomials. Define e.g. a univariate n-th order polynomial:

f[x_, n_] := Total @ Array[ a[#] x^# &  , n + 1, 0]

and among this class the following function yields all solutions (with multiplicity counting):

sol[n_] := With[{ sol = SolveAlways[ f[x + y, n]^2 == f[x, n]^2 + f[y, n]^2, {x, y}]}, 
                { DeleteDuplicates @ #, Length @ #}& @ sol]

for third order polynomials:

{{{a[0] -> 0, a[1] -> 0, a[2] -> 0, a[3] -> 0}}, 6}

while for e.g. seventh order polynomials:

{{{a[0] -> 0, a[1] -> 0, a[2] -> 0, a[3] -> 0, a[4] -> 0, a[5] -> 0,
   a[6] -> 0, a[7] -> 0}}, 720}

We might find other ways but this one demonstrates clearly what kind of problems we encounter.

share|improve this answer
as an aside, if f does not have to be real then f-> Function[x,I^(-1-(I Log[x])/\[Pi])] is a possible solution. – chuy Aug 28 '13 at 19:14
which of course is an overcomplicated way to write -I Sqrt[x]... – chuy Aug 28 '13 at 19:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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