Find #f# ?

#f''(x)+f(x)=1# ,
#x##in##RR#

2 Answers
Apr 19, 2018

#f(x) = 1+A cos x+B sin x#

Explanation:

The quickest way of solving this equation is to note that the function

#g(x) = f(x)-1#

satisfies

#g''(x) = f" (x) = 1-f(x) = -g(x)#

or

#g''(x) +g(x) = 0#

This is a familiar equation with the well known solution

#g(x) = A cos x + B sin x#

where #A# and #B# are arbitrary real constants.

Apr 19, 2018

#f(x) = 1+C cos(x+phi)#

Explanation:

If you want a quick solution, see https://socratic.org/s/aQcKQPv8

I will describe a more detailed solution here. This involves much more work, but has the advantage of being a much more general method. It is also a simple introduction to the factorization method for solving differential equations.

Let us denote the operator #d/dx# by #D#. Then the equation is

#(D^2+1)f(x) = 1#

We can write

#D^2+1 = (D+i)(D-i)#

where the use of the familiar formula #a^2-b^2 = (a-b)(a+b)# is legitimate because #D# commutes with #i#. So, our equation is

#(D+i)(D-i)f(x) = 1#

Denoting #(D-i)f(x)# by #g(x)# we see that #g(x)# obeys the simple first order linear equation :

#(D+i)g(x) = 1 qquad "i.e." qquad (dg)/dx +ig = 1#

This is easily solved by introducing the integrating factor #e^{ix}#

#e^{ix} (dg)/dx +ie^{ix}g=e^{ix} implies#

#d/dx(e^{ix} g) = e^{ix} implies#

#e^{ix}g(x) = 1/i e^{ix}+A#
where #A# is a constant of integration. So

#g(x) = -i+Ae^{-ix}#

But #g(x) = (D-i)f(x)#, which means that #f(x)# obeys the first order linear differential equation

# (df)/dx-i f = -i+ Ae^{-ix} #

This equation has an integrating factor #e^{-ix}#, which allows us to write

# d/dx(fe^{-ix})=(-i+ Ae^{-ix} )e^{-ix} = -ie^{-ix}+Ae^{-i2x}#

This is easily integrated to

# fe^{-ix} = e^{-ix}+A/(-2i)e^{-i2x}+B#

leading to

#f(x) = 1+ A^'e^{-ix}+Be^{ix} #

This is the required solution, but we have one more step to go. The solution has to be real, and so must be equal to its complex conjugate. It is easy to see that this means that #A^'=B^"*"#. Introducing two real constant constant #C# and #phi# by

#B = C/2 e^{i phi}#

the solution becomes

#f(x) = 1+C cos(x+phi)#