Find a closed-form solution for $f(x)$ in the following equation
$$ f(x) = x + \lambda \int_0^1 f(z)\,dz $$ where $\lambda$ is a constant
I tried integrating both sides from $0$ to $1$ but wasn't exactly sure where to go from there
$$ \int_0^1 f(x) = \int_0^1 \left[x + \int_0^1 f(z)\,dz\right] dx $$
If you differentiate both sides w.r.t. $x$, you get $f'(x) = 1$.
Therefore, $f(x) = x+C$ for some constant $C$. Substituting this back in yields:
$x+C = x+\lambda \displaystyle\int_{0}^{1}(x+C)\,dx$
$x+C = x+\lambda\left(\dfrac{1}{2}+C\right)$
$C = \dfrac{\lambda}{2}+\lambda C$
$C = \dfrac{\lambda}{2(1-\lambda)}$.
Therefore, the solution is $f(x) = x+\dfrac{\lambda}{2(1-\lambda)}$ (assuming $\lambda \neq 1$).
Also, your approach will work out. For convenience, let $I = \displaystyle\int_{0}^{1}f(x)\,dx$. Then, you get:
$\displaystyle\int_{0}^{1}f(x)\,dx = \int_{0}^{1}\left[x+\lambda\int_{0}^{1}f(z)\,dz\right]\,dx$
$I = \displaystyle\int_{0}^{1}(x+\lambda I)\,dx$
$I = \dfrac{1}{2}+\lambda I$
$I = \dfrac{1}{2(1-\lambda)}$
So, the solution is $f(x) = x+\lambda\displaystyle\int_{0}^{1}f(z)\,dz = x+\lambda I = x+\dfrac{\lambda}{2(1-\lambda)}$, which agrees with the result from our first method.