Find the $f(x)$ from the given information So tomorrow I tackled a maths test where I faced a question which was saying,

Question: Let $f:R-\{0,1\}\rightarrow R$ be a function satisfying the relation
$$f(x)+f\left(\frac{x-1}{x}\right)=x$$
for all $x\in R-\{0,1\}$
Find  $f(x)$?

Till yet I tried so many replacements as like replacing $x\rightarrow \frac{1}{x}$ and $x\rightarrow \frac{x-1}{x}$, but these are not the appropriate ones to get my answer.
These kind of questions are not new to me as I had solved many before and even asked one before to (here is it). But here my main issue is that I am not getting an appropriate replacements and that's the thing for which I had raised my question.
Thanks in advance.
 A: Let $g(x)=1-\frac{1}{x}=\frac{x-1}{x}$. Then $g(g(x))=1-\frac{x}{x-1}=\frac{1}{1-x}$, $g(g(g(x)))=1-\frac{1-x}{1}=x$. Notice that $g(x)\neq 1$ and $g(x)\neq 0$ is $x\neq 1$. By assumption, we have $f(x)+f(g(x))=x$ for every $x\in\mathbb{R}\setminus\left\{0,1\right\}$, so we obtain the equations
$$f(x)+f(g(x))=x\qquad (1)$$
$$f(g(x))+f(g(g(x)))=g(x)\qquad(2)$$
$$f(g(g(x)))+f(g(g(g(x))))=g(g(x))\qquad (3)$$
We can calculate equation (1)-(2)+(3), and cancel the terms $f(g(x))$ and $f(g(g(x))$, thus obtaining
\begin{align*}
2f(x)&=f(x)+f(g(g(g(x))))=x-g(x)+g(g(x))=x-\frac{x-1}{x}+\frac{1}{1-x}\\
&=\frac{x^2(1-x)-(x-1)(1-x)+x}{x(1-x)}=\frac{x^2-x^3+x^2-2x+1+x}{x(1-x)}\\
&=\frac{x^3-2x^2+x-1}{x(x-1)}
\end{align*}
A: I know that @Luiz had provided a great answer and I'll definitely mark his answer as the accepted answer but I think going with that much $f(g(g(g(x))))$ might be a confusing stuff, at least for me. So here I came up with my own answer which I think might also help others. So here it goes.

Answer: Given,
$$f(x)+f\left(\frac{x-1}{x}\right)=x\qquad---(1)$$
In equation $(1)$ replacing $x\rightarrow \frac{x-1}{x}$, we get,
$$f\left(\frac{x-1}{x}\right)+f\left(\frac{1}{1-x}\right)=\frac{x-1}{x}\qquad---(2)$$
In equation $(1)$ replacing $x\rightarrow \frac{1}{1-x}$, we get,
$$f\left(\frac{1}{1-x}\right)+f(x)=\frac{1}{1-x}\qquad---(3)$$
So by equating $(1) - (2) + (3)$ we get,
$$2f(x)=\left(x+\frac{1}{1-x}-\frac{x-1}{x}\right)$$
$$\implies f(x)=\frac{1}{2}\left(x+\frac{1}{1-x}-\frac{x-1}{x}\right)\qquad$$

Got it! :)
