# Form of particular solution to inhomogeneous differential equation

I want to solve the initial value problem $$x''(t)+3x'(t)+2x(t)=\frac{1}{1+e^t}, \quad x(0)=2\ln2,~x'(0)=1-3\ln 2$$

considering the homogeneous couterpart $$x''(t)+3x'(t)+2x(t)=0$$ with the characteristic polynomial $$\chi(\lambda)=\lambda^2+3\lambda+2=(\lambda+1)(\lambda+2)$$ the general solution to the homogeneous equation is of the form $$x(t)=c_1e^{-1t}+c_2e^{-2t}$$ using my initial conditions $$x(0)=c_1+c_2=2\ln 2, \quad x'(0)=-c_1-2c_2=1-3\ln 2$$ I have $$c_1=1+\ln2,~c_2=-1+\ln 2,\quad x(t)=(1+\ln 2)e^{-t}+(-1+\ln 2)e^{-2t}$$

Solution using @Karn Watcharasupat's method: $u := x+x', \quad u'=x'+x''$ the equation becomes a first order linear differential equation, with $\mu$ integration factor such that $\mu 2=\mu'\Rightarrow \mu = e^{2t}$ $$u'+2u=\frac{1}{1+e^t}$$ $$(\mu u)'=\mu \frac{1}{1+e^t}\iff \frac{d\left(e^{2t}u\right)}{dt}=\frac{e^{2t}}{1+e^t}$$ $$e^{2t}u=\int \frac{e^{2t}}{1+e^t}dt=\int \frac{v-1}{v} dv=\int 1 dv - \int \frac{1}{v}dv=v-\ln |v|=1+e^t-\ln|1+e^t|+C_1$$ for $v:=1+e^t$. And then $$u=\frac{e^t-\ln|1+e^t|+C_2}{e^{2t}}=e^{-t}-e^{-2 t}\ln|1+e^t|+e^{-2t}C_2$$ Plugging back in $$x+x'=C_2e^{-2t}+e^{-t}-e^{-2 t}\ln(1+e^t)$$ which is similarly a first order ODE with $\mu=\mu'\Rightarrow \mu=e^t$ $$\left(x\mu\right)'=\mu\cdot \left(C_2e^{-2t}+e^{-t}-e^{-2 t}\ln(1+e^t)\right)=e^t\left(C_2e^{-2t}+e^{-t}-e^{-2 t}\ln(1+e^t)\right)$$ $$\frac{d\left(xe^t\right)}{dt}=\left(C_2e^{-t}+1-e^{- t}\ln(1+e^t)\right)$$ \begin{align}xe^t&=\int \left(C_2e^{-t}+1-e^{- t}\ln(1+e^t)\right) dt\\&=\int C_2e^{-t} dt+\int 1 dt -\int e^{- t}\ln(1+e^t) dt\\&=-C_2e^{-t}+t-\left[-e^{-t}\ln \left(e^t+1\right)+t-\ln \left|e^t+1\right|+C\right]\\&=-C_2e^{-t}+t+e^{-t}\ln \left(e^t+1\right)-t+\ln \left(e^t+1\right)+C\\&=C_2e^{-t}+e^{-t}\ln \left(e^t+1\right)+\ln \left(e^t+1\right)+C\end{align} And finally $$x=\frac{C_2e^{-t}+e^{-t}\ln \left(e^t+1\right)+\ln \left(e^t+1\right)+C}{e^t}=C_2e^{-2t}+e^{-2t}\ln \left(e^t+1\right)+e^{-t}\ln \left(e^t+1\right)+Ce^{-t}$$ $$x(t)=C_1e^{-t}+C_2e^{-2t}+e^{-t}\ln \left(e^t+1\right)+e^{-2t}\ln \left(e^t+1\right)$$ $$x'(t)=-C_1e^{-t}-2C_2e^{-2t}-e^{-t}\ln \left(e^t+1\right)+\frac{1}{e^t+1}-2e^{-2t}\ln \left(e^t+1\right)+\frac{e^{-t}}{e^t+1}$$ Finding $C_1,~C_2$ $$x(0)=C_1+C_2+2\ln(2)=2\ln(2)\Rightarrow C_1=-C_2$$ $$x'(0)=-C_1-2C_2-\ln 2+\frac{1}{2}-2\ln 2+\frac{1}{2}=1-3\ln 2 \Rightarrow C_1=-2C_2$$ So $$C_1=C_2=0$$ and the solution to the IVP is $$x(t)=e^{-t}\ln \left(e^t+1\right)+e^{-2t}\ln \left(e^t+1\right)$$

• Wolfram|Alpha gives $e^{-2t}\ln(e^t+1)$ and $e^{-t}\ln(e^t+1)$ as the particular solutions. I'm trying to figure out how to get these... Commented Dec 22, 2017 at 8:04

You can only apply the guessing process if the left side has constant coefficients and the right side only terms of the form polynomial times exponential.

As your right side is not of this form, you will need to apply the variation of constants method. $$y(t)=c_1(t)y_1(t)+c_2(t)y_2(t)$$ where $$c_1'(t)y_1(t)+c_2'(t)y_2(t)=0\\ c_1'(t)y_1'(t)+c_2'(t)y_2'(t)=f(t)$$ so that $$c_1'(t)=-\frac{f(t)y_2(t)}{W(t)},\\ c_2'(t)=\frac{f(t)y_1(t)}{W(t)},\\ W(t)=y_1(t)y_2'(t)-y_1'(t)y_2(t),$$ As $W(t)=\det\pmatrix{e^{-t}&e^{-2t}\\-e^{-t}&-2e^{-2t}}=-e^{-3t}$. This gives the coefficient functions as This involves computing the integrals $$c_1(t)=-\int\frac{e^t}{1+e^t}dt\text{ and }c_2(t)=\int\frac{e^{2t}}{1+e^t}dt$$ which both are symbolically solvable.

• I can't upvote yet but thanks for the general solution!
– user515599
Commented Dec 23, 2017 at 18:09

I will first use the substitution $$u=x+x'$$

So we have $$x''(t)+3x'(t)+2x(t)=\frac{1}{1+e^t}$$ transforming into $$u'+2u=\frac{1}{1+e^t}$$

So we have the IF $$e^{\int 2 \ dt}=e^{2t}$$

So \begin{align} \frac{d}{dt}(e^{2t}u)&=\frac{e^{2t}}{1+e^t}\\ e^{2t}u&=\int \frac{e^{2t}}{1+e^t}\ dt\\ &=e^t - \ln(1 + e^t)+C_1\\ u&=C_1e^{-2t}+e^{-t}-e^{-2t}\ln(1 + e^t)\\ \end{align} Substituting $u=x+x'$ back in, \begin{align} x+x'&=C_1e^{-2t}+e^{-t}-e^{-2t}\ln(1 + e^t)\\ \end{align}

This is a first order LODE again with IF $=e^t$.

\begin{align} \frac{d}{dt}(e^{t}x)&=(e^t)(C_1e^{-2t}+e^{-t}-e^{-2t}\ln(1 + e^t))\\ &=C_1e^{-t}+1 - e^{-t} \ln(1 + e^t)\\ e^{t}x&=\int C_1e^{-t}+ 1 - e^{-t} \ln(1 + e^t) \ dt\\ &=-C_1e^{-t}+ \ln(1 + e^{-t}) + e^{-t} \ln(1 + e^t)+C_2\\ x&=-C_1e^{-2t}+C_2e^{-t}+ e^{-t}\ln(1 + e^{-t}) + e^{-2t} \ln(1 + e^t) \end{align}

• Thank you for answer, it will take some time to process.
– user515599
Commented Dec 22, 2017 at 8:27
• would you say such a substitution is possible for 2nd order linear inhomogeneous equations (simple ones) in general? or just in this case? (the little mistake is in the integration, the $t$ cancles out)
– user515599
Commented Dec 22, 2017 at 9:10
• @Noob It just happens to be nice in this case. Commented Dec 22, 2017 at 9:15
• You can use this process in all cases where you have constant coefficients. You are transforming $(D-λ_1)(D-λ_2)...(D-λ_n)x=f$ into $(D-λ_1)u_1=f$, $(D-λ_2)u_2=u_1$, ..., $(D-λ_n)u_n=u_{n-1}$ and $x=u_n$. Sometimes this gives a faster solution than the more general variation of constants. Commented Dec 22, 2017 at 11:08
• @LutzL I didn't know how to proceed with your answer. Would appreciate a link to where that method is explained.
– user515599
Commented Dec 22, 2017 at 12:13