Mister Exam

# Differential equation x^2y''+4xy'+2y=e^x

The teacher will be very surprised to see your correct solution 😉

### Solve with variation of parameters

Solve x^2 (d^2 y(x))/(dx^2) + 4 x (dy(x))/(dx) + 2 y(x) = e^x:

The general solution will be the sum of the complementary solution and particular solution.
Find the complementary solution by solving x^2 (d^2 y(x))/(dx^2) + 4 x (dy(x))/(dx) + 2 y(x) = 0:

Assume a solution to this Euler-Cauchy equation will be proportional to x^λ for some constant λ.
Substitute y(x) = x^λ into the differential equation:
x^2 (d^2 )/(dx^2) (x^λ) + 4 x d/(dx) (x^λ) + 2 x^λ = 0

Substitute (d^2 )/(dx^2) (x^λ) = λ (λ - 1) x^(λ - 2) and d/(dx) (x^λ) = λ x^(λ - 1):
λ^2 x^λ + 3 λ x^λ + 2 x^λ = 0

Factor out x^λ:
(λ^2 + 3 λ + 2) x^λ = 0

Assuming x!=0, the zeros must come from the polynomial:
λ^2 + 3 λ + 2 = 0

Factor:
(λ + 1) (λ + 2) = 0

Solve for λ:
λ = -2 or λ = -1

The root λ = -2 gives y_1(x) = c_1/x^2 as a solution, where c_1 is an arbitrary constant.
The root λ = -1 gives y_2(x) = c_2/x as a solution, where c_2 is an arbitrary constant.
The general solution is the sum of the above solutions:
y(x) = y_1(x) + y_2(x) = c_1/x^2 + c_2/x

Determine the particular solution to x^2 (d^2 y(x))/(dx^2) + 4 x (dy(x))/(dx) + 2 y(x) = e^x by variation of parameters:
List the basis solutions in y_c(x):
y_(b_1)(x) = 1/x^2 and y_(b_2)(x) = 1/x

Compute the Wronskian of y_(b_1)(x) and y_(b_2)(x):
W(x) = left bracketing bar 1/x^2 | 1/x
d/(dx) (1/x^2) | d/(dx) (1/x) right bracketing bar = left bracketing bar 1/x^2 | 1/x
-2/x^3 | -1/x^2 right bracketing bar = 1/x^4

Divide the differential equation by the leading term's coefficient x^2:
(d^2 y(x))/(dx^2) + (4 (dy(x))/(dx))/x + (2 y(x))/x^2 = e^x/x^2

Let f(x) = e^x/x^2:
Let v_1(x) = - integral(f(x) y_(b_2)(x))/W(x) dx and v_2(x) = integral(f(x) y_(b_1)(x))/W(x) dx:
The particular solution will be given by:
y_p(x) = v_1(x) y_(b_1)(x) + v_2(x) y_(b_2)(x)

Compute v_1(x):
v_1(x) = - integral e^x x dx = -e^x (x - 1)

Compute v_2(x):
v_2(x) = integral e^x dx = e^x

The particular solution is thus:
y_p(x) = v_1(x) y_(b_1)(x) + v_2(x) y_(b_2)(x) = -(e^x (x - 1))/x^2 + e^x/x

Simplify:
y_p(x) = e^x/x^2

The general solution is given by:
| y(x) = y_c(x) + y_p(x) = c_1/x^2 + c_2/x + e^x/x^2

### Solve with subtitution

Solve x^2 (d^2 y(x))/(dx^2) + 4 x (dy(x))/(dx) + 2 y(x) = e^x:

Let y(x) = v(x)/x^2, which gives (dy(x))/(dx) = ((dv(x))/(dx))/x^2 - (2 v(x))/x^3 and (d^2 y(x))/(dx^2) = ((d^2 v(x))/(dx^2))/x^2 - (4 (dv(x))/(dx))/x^3 + (6 v(x))/x^4:
4 x (((dv(x))/(dx))/x^2 - (2 v(x))/x^3) + x^2 (((d^2 v(x))/(dx^2))/x^2 - (4 (dv(x))/(dx))/x^3 + (6 v(x))/x^4) + (2 v(x))/x^2 = e^x

Simplify:
(d^2 v(x))/(dx^2) = e^x

Integrate both sides with respect to x:
(dv(x))/(dx) = integral e^x dx = e^x + c_1, where c_1 is an arbitrary constant.

Integrate both sides with respect to x:
v(x) = integral(e^x + c_1) dx = e^x + x c_1 + c_2, where c_2 is an arbitrary constant.

Substitute back for y(x) = v(x)/x^2, which gives v(x) = x^2 y(x):
x^2 y(x) = e^x + c_1 x + c_2

Solve for y(x):
| y(x) = (e^x + c_1 x + c_2)/x^2

### Solve as an exact equation

Solve x^2 (d^2 y(x))/(dx^2) + 4 x (dy(x))/(dx) + 2 y(x) = e^x:

Substitute 2 = d/(dx) (4 x) - (d^2 )/(dx^2) (x^2):
x^2 (d^2 y(x))/(dx^2) + 4 x (dy(x))/(dx) + (d/(dx) (4 x) - (d^2 )/(dx^2) (x^2)) y(x) = e^x

Expand:
x^2 (d^2 y(x))/(dx^2) + 4 x (dy(x))/(dx) + d/(dx) (4 x) y(x) - (d^2 )/(dx^2) (x^2) y(x) = e^x

Add and subtract (dy(x))/(dx) d/(dx) (x^2) to the left hand side:
d/(dx) (x^2) (dy(x))/(dx) + x^2 (d^2 y(x))/(dx^2) + 4 x (dy(x))/(dx) + d/(dx) (4 x) y(x) - d/(dx) (x^2) (dy(x))/(dx) - (d^2 )/(dx^2) (x^2) y(x) = e^x

Apply the reverse product rule f (dg)/(dx) + g (df)/(dx) = d/(dx) (f g) to the left-hand side:
d/(dx) (x^2 (dy(x))/(dx)) + d/(dx) (4 x y(x)) - d/(dx) (2 x y(x)) = e^x

Factor:
d/(dx) (x^2 (dy(x))/(dx) + 2 x y(x)) = e^x

Integrate both sides with respect to x:
integral d/(dx) (x^2 (dy(x))/(dx) + 2 x y(x)) dx = integral e^x dx

Evaluate the integrals:
x^2 (dy(x))/(dx) + 2 x y(x) = e^x + c_1, where c_1 is an arbitrary constant.

Solve the first order linear equation:
| y(x) = (e^x + c_1 x + c_2)/x^2

v

y() =
y'() =
y''() =
y'''() =
y''''() =

from to