First check the characteristic solution. The characteristic equation to this DE is
r ² - r = r (r - 1) = 0
with roots r = 0 and r = 1, so the characteristic solution is
y (char.) = C₁ exp(0x) + C₂ exp(1x)
y (char.) = C₁ + C₂ exp(x)
For the particular solution, we try the ansatz
y (part.) = (ax + b) exp(x)
but exp(x) is already accounted for in the second term of y (char.), so we multiply each term here by x :
y (part.) = (ax ² + bx) exp(x)
Differentiate this twice and substitute the derivatives into the DE.
y' (part.) = (2ax + b) exp(x) + (ax ² + bx) exp(x)
… = (ax ² + (2a + b)x + b) exp(x)
y'' (part.) = (2ax + 2a + b) exp(x) + (ax ² + (2a + b)x + b) exp(x)
… = (ax ² + (4a + b)x + 2a + 2b) exp(x)
(ax ² + (4a + b)x + 2a + 2b) exp(x) - (ax ² + (2a + b)x + b) exp(x)
= x exp(x)
The factor of exp(x) on both sides is never zero, so we can cancel them:
(ax ² + (4a + b)x + 2a + 2b) - (ax ² + (2a + b)x + b) = x
Collect all the terms on the left side to reduce it to
2ax + 2a + b = x
Matching coefficients gives the system
2a = 1
2a + b = 0
and solving this yields
a = 1/2, b = -1
Then the general solution to this DE is
y(x) = C₁ + C₂ exp(x) + (1/2 x ² - x) exp(x)
For the given initial conditions, we have
y (0) = C₁ + C₂ = 6
y' (0) = C₂ - 1 = 5
and solving for the constants here gives
C₁ = 0, C₂ = 6
so that the particular solution to the IVP is
y(x) = 6 exp(x) + (1/2 x ² - x) exp(x)