You likely mean to write the differential equation,
y'' - 2y' + y = exp(x)
The homogeneous part
y'' - 2y' + y = 0
has characteristic equation
r² - 2r + 1 = (r - 1)² = 0
with a root at r = 1 with multiplicity 2, so the characteristic solution is
y = C₁ exp(x) + C₂ x exp(x)
For the particular solution, we assume an ansatz
y = ax² exp(x)
where a is an unknown constant. Differentiating the ansatz twice:
y' = ax² exp(x) + 2ax exp(x) = (ax² + 2ax) exp(x)
y'' = (ax² + 2ax) exp(x) + (2ax + 2a) exp(x) = (ax² + 4ax + 2a) exp(x)
Substitute y and its derivatives into the DE:
(ax² + 4ax + 2a) exp(x) - 2 (ax² + 2ax) exp(x) + ax² exp(x) = exp(x)
Solve for a :
(ax² + 4ax + 2a) - 2 (ax² + 2ax) + ax² = 1
2a = 1
a = 1/2
Then the particular solution is
y = 1/2 x² exp(x)
The general solution is then
y = C₁ exp(x) + C₂ x exp(x) + 1/2 x² exp(x)