# How can I solve a functional equation with domain restrictions?

I have three properties for a function:

Assumptions -> 0 <= x <= 1

f[1 - x] == 1 - f[x]
f[x/3] == 1/2 f[x]
Assuming[0 <= a <= b <= 1, f[a] <= f[b]]


And I would like to solve for the following: f[6/7]

I tried using RSolve, but I don't know how to put those equations in with a domain constraint as well.

• Even though I don't think you can find an exact solution, it turns out f[x_] := ArcSin[x]/Sqrt[2 x] almost works satisfying the equations within about 0.10 error over most of the domain and has the increasing property too. Of course that error will quickly blow up after a few iterations. – flinty Nov 23 '20 at 16:51

Consider the so-called Cantor function.

Plot[CantorStaircase[x], {x, 0, 1}]


As the following plot confirms it does have the functional properties.

Plot[{CantorStaircase[1-x]-(1-CantorStaircase[x]),CantorStaircase[x/3]-CantorStaircase[x]/2}, {x, 0, 1}]


Moreover, it is CantorStaircase[6/7] equal to $$3/4$$.

It can be shown (see Chalice, D. R. "A Characterization of the Cantor Function." Amer. Math. Monthly 98, 255-258, 1991.) that this is the only real-valued increasing function satisfying your equations.

I'm not sure if RSolve is able to recover that kind of function.

There can be no solution, because the both equations contradict each other.

First get solution for second equation.

eqs = {f[1 - x] == 1 - f[x], f[x/3] == 1/2 f[x]};

fs = f /. First@RSolve[eqs[[2]], f, x]

(*   Function[{x}, 2^(-1 + Log[x]/Log[3]) C[1]]   *)


Solve for the constant C[1] with equation 1 and you see,that C[1] depends on x, but it should be constant.

sol = First@Solve[eqs[[1]] /. f -> fs, C[1]]

(*   {C[1] -> 2/(2^(Log[1 - x]/Log[3]) + 2^(Log[x]/Log[3]))}   *)

Plot[C[1] /. sol, {x, 0, 1}]