tihs is going to sound like a stupid question, but how do i do it when the right side is like this?
x''+4x=1+t+sin(t) with initial conditions x(0)=0 and x'(0)=0
Hello gambler84Since you talk about the right-hand-side, I assume you know how to solve the Complementary Function to get
$\displaystyle x = A\cos 2t + B \sin 2t$
Next, you need to find the Particular Integral, by saying.
Let $\displaystyle x = P +Qt +R\cos t + S\sin t$
Then $\displaystyle \dot{x} = Q - R\sin t + S\cos t$
$\displaystyle \Rightarrow \ddot{x} = -R\cos t - S\sin t $
$\displaystyle \Rightarrow -R\cos t - S\sin t + 4(P +Qt +R\cos t + S\sin t) \equiv 1 + t + \sin t$
Comparing coefficients gives
$\displaystyle P=Q= \tfrac{1}{4}, R = 0, S = \tfrac{1}{3}$
So the solution to the PI is
$\displaystyle x =\tfrac{1}{4} + \tfrac{1}{4}t +\tfrac{1}{3}\sin t$
The general solution to your equation is the sum of the solutions to the PI and the CF:
$\displaystyle x = A\cos 2t + B \sin 2t + \tfrac{1}{4} + \tfrac{1}{4}t +\tfrac{1}{3}\sin t$
Plug in your initial conditions and you're done.
Grandad