Find all functions $f: \mathbb{R} \rightarrow \mathbb{R}$ such that for all real numbers $x \neq 0$,

$$
f(x)+2 f\left(\frac{x-1}{x}\right)=3 x .
$$

(Note that the function must be defined for all $x \in \mathbb{R}$, including $x=0$.)
(Problem Source: Aops) Plugging $\frac{x-1}{x}$ in for $x$ in the functional equation gives

$$
f\left(\frac{x-1}{x}\right)+2 f\left(\frac{\frac{x-1}{x}-1}{\frac{x-1}{x}}\right)=f\left(\frac{x-1}{x}\right)+2 f\left(\frac{1}{1-x}\right)=\frac{3(x-1)}{x} .
$$

Now plugging $\frac{1}{1-x}$ in for $x$ gives

$$
f\left(\frac{1}{1-x}\right)+2 f\left(\frac{\frac{1}{1-x}-1}{\frac{1}{1-x}}\right)=f\left(\frac{1}{1-x}\right)+2 f(x)=\frac{3}{1-x} .
$$

We now have three equations in three "variables":

$$
\begin{aligned}
f(x)+2 f\left(\frac{x-1}{x}\right) & =3 x, \\
f\left(\frac{x-1}{x}\right)+2 f\left(\frac{1}{1-x}\right) & =\frac{3(1-x)}{x}, \\
f\left(\frac{1}{1-x}\right)+2 f(x) & =\frac{3}{1-x} .
\end{aligned}
$$

To isolate $f(x)$, we take equation (1) minus 2 times equation (2) plus 4 times equation (3), which makes the $f\left(\frac{x-1}{x}\right)$ and $f\left(\frac{1}{1-x}\right)$ terms on the left cancel and gives

$$
9 f(x)=3 x-2 \cdot \frac{3(x-1)}{x}+4 \cdot \frac{3}{1-x} .
$$

Dividing by 9 on both sides and combining terms on the right with a common denominator gives

$$
\begin{aligned}
f(x) & =\frac{x^{2}(1-x)+2(1-x)^{2}+4 x}{3 x(1-x)} \\
& =\frac{-x^{3}+3 x^{2}+2}{3 x(1-x)} .
\end{aligned}
$$

However, we note that this function is not defined for $x=0$ or $x=1$, while the domain of $f$ should be all real numbers. The only constraint on $f(0)$ and $f(1)$ comes from plugging $x=1$ into the functional equation, giving

$$
f(1)+2 f(0)=3 \text {. }
$$

Thus, $f(0)$ can be any real number $c$, and $f(1)$ must be $3-2 c$. Putting this together gives the solutions

$$
f(x)= \begin{cases}\frac{-x^{3}+3 x^{2}+2}{3 x(1-x)} & x \neq 0,1 \\ c & x=0, \\ 3-2 c & x=1\end{cases}
$$

for any real number $c$.