# Solving second order differential equation in a hurry

During last test I had to solve second order ODE: $y'' + 3y = e^x + 1$. I managed to write the general solution of homogenous equation (with RHS replaced by zero): $$y = c_1 \cos \left(\sqrt{3} x\right) + c_2 \sin \left(\sqrt{3} x\right).$$

That wasn't hard. But how to find (at least one) the general solution? Using sosmath (Method of Variation of Parameters) I found out that: \begin{align} u_1 & = \sqrt{3} \int \sin \left(\sqrt{3} x\right) (e^x + 1) \,\textrm{d}x = \frac{\sqrt{3}}{12} \cdot \left(3e^x \sin \left(\sqrt 3 x\right) - \sqrt 3 (4+3e^x) \cos \left(\sqrt 3 x\right) \right) + C_1 \\ u_2 & = \sqrt{3} \int \cos \left(\sqrt{3} x\right) (e^x + 1) \,\textrm{d}x = \frac{\sqrt{3}}{12} \cdot \left(3e^x \cos \left(\sqrt 3 x\right) + \sqrt 3 (4+3e^x) \sin \left(\sqrt 3 x\right) \right) + C_2, \end{align} after what I don't know how to proceed. There must be a simpler way, because one can guess the solution to be $$y(x) = \frac{4 + 3e^x}{12}.$$

try the method undetermined coefficients; try a particular solution of the form $$y = ae^x + b, y' = ae^x, y'' = ae^x.$$ sub this in $$y'' + 3y = e^x + 1 \to ae^x + 3(ae^x + b)=e^x + 1 \to a = \frac 14, b = \frac 13$$
therefore, a particular solution is $$y_p = \frac 14 e^x + \frac 13, y_g = Ce^{-3x}+y_p$$