Given that the function $f$ is continuous and has the property $f(f(x))=1-x$ for all $x\in[0,1]$. Find $J=\int_{0}^{1}f(x)dx$.
My try:
I did this problem without finding the function $f(x)$, but I am interested in finding the function $f(x)$. So what I did is I replaced $x$ with $f^{-1}(x)$ in the given equation (I assumed $f^{-1}$ exists.):
$$\tag{1} f(x)=1-f^{-1}(x).$$
Also, by applying $f^{-1}$ on both sides of given equation
$$f(x)=f^{-1}(1-x).$$
Replacing $x$ with $1-x$,
$$f(1-x)=f^{-1}(x).$$
Substituting in $(1)$ I got
$$f(x)+f(1-x)=1.$$
This actually seemed to be a easier equation but I couldn't solve it. Particularly I think that it might be a piecewise function.