# How to reach the solution to this ODE?

To obtain the steady state solution for the temperature distribution in a rod I've reached the following ODE:

$$\mu T''(x)=-1 + T(x)$$

under the boundary conditions $T(0)=T(1)=0$. The solution is apparently:

$$T(x)=1-\frac{\cosh{(\frac{x-0.5}{\sqrt{\mu}})}}{\cosh{(\frac{0.5}{\sqrt{\mu}})}}$$

So far I've got $T(x) = C_1\exp({\frac{x}{\sqrt{\mu}}})+C_2\exp({-\frac{x}{\sqrt{\mu}}})$ and I've tried implementing the boundary conditions to obtain $C_1$ and $C_2$ but I can't seem to reach the solution. Any ideas?

I suppose that you missed the $1$ in the differential equation. Without conditions, the solution is (as you got it almost) $$T(x)=1+c_1 e^{\frac{x}{\sqrt{\mu }}}+c_2 e^{-\frac{x}{\sqrt{\mu }}}$$
So, $$T(0)=1+c_1+c_2 =0\qquad , \qquad T(1)=1+c_1 e^{\frac{1}{\sqrt{\mu }}}+c_2 e^{-\frac{1}{\sqrt{\mu }}}=0$$ leading to $$c_1=-\frac{1}{e^{\frac{1}{\sqrt{\mu }}}+1}\qquad , \qquad c_2=\frac{1}{e^{\frac{1}{\sqrt{\mu }}}+1}-1$$ which leads to
$$T(x)=-\frac{e^{-\frac{x}{\sqrt{\mu }}} \left(e^{\frac{x}{\sqrt{\mu }}}-1\right) \left(e^{\frac{x}{\sqrt{\mu }}}-e^{\frac{1}{\sqrt{\mu }}}\right)}{e^{\frac{1}{\sqrt{\mu }}}+1}$$
Rearranging( expand the exponentials and use addition formulae, you should effectively obtain $$T(x)=1-\text{sech}\left(\frac{1}{2 \sqrt{\mu }}\right) \cosh \left(\frac{1-2 x}{2 \sqrt{\mu }}\right)$$