Home » Blog » Solve the differential equation y′ + xy = x3 for given initial values

Solve the differential equation y′ + xy = x3 for given initial values

Solve the following differential equation:

    \[ y' + xy = x^3 \qquad \text{on} \qquad (-\infty, +\infty) \]

with y = 0 when x = 0.


From Theorem 8.3 (page 310 of Apostol) we know that a differential equation of the form

    \[ y' + P(x)y = Q(x), \qquad \text{with} \quad f(a) = b, \]

on an interval I has solution given by

    \[ f(x) = be^{-A(x)} + e^{-A(x)} \int_a^x Q(t)e^{A(t)} \, dt \]

where

    \[ A(x) = \int_a^x P(t) \, dt. \]

In this particular case we apply the theorem with

    \[ P(x) = x, \qquad Q(x) = x^3, \qquad a = b = 0. \]

This gives us

    \[ A(x) = \int_0^x t \, dt = \frac{1}{2}x^2. \]

Therefore,

    \begin{align*}  f(x) &= be^{-A(x)} + e^{-A(x)} \int_a^x Q(t)e^{A(t)} \, dt \\[9pt]  &= e^{-\frac{1}{2}x^2} \int_0^x t^3 e^{\frac{1}{2} t^2} \, dt. \end{align*}

To evaluate this integral we use integration by parts, letting

    \begin{align*}  u &= t^2 & du &= 2t \, dt \\  dv &= te^{\frac{1}{2}t^2} \, dt & v &= e^{\frac{1}{2}t^2}. \end{align*}

So,

    \begin{align*}  \int_0^x t^3 e^{\frac{1}{2}t^2} \, dt &= t^2 e^{\frac{1}{2}t^2} \Bigr \rvert_0^x - \int_0^x 2t e^{\frac{1}{2}t^2} \, dt \\[9pt]  &= x^2 e^{\frac{1}{2}x^2} - 2e^{\frac{1}{2}x^2} + 2 \\[9pt]  &= x^2 e^{\frac{1}{2}x^2} + 2 - 2e^{\frac{1}{2}x^2}. \end{align*}

Therefore, putting this back into our formula for f(x),

    \begin{align*}  f(x) &= e^{-\frac{1}{2}x^2} \int_0^x t^3 e^{\frac{1}{2} t^2} \, dt \\[9pt]  &= e^{-\frac{1}{2}x^2} \left( x^2 e^{\frac{1}{2}x^2} + 2 - 2e^{\frac{1}{2}x^2} \right) \\[9pt]  &= x^2 + 2e^{-\frac{1}{2}x^2} - 2. \end{align*}

Point out an error, ask a question, offer an alternative solution (to use Latex type [latexpage] at the top of your comment):