Given a function:
$$ y'' - y' = x$$ I want to find the solution where $x = 1$, $y = 1$, $dy/dx = 2$.
I have managed to find the full form of the equation by first finding the complementary function solution and then the particular solution.
The problem is if I apply the boundary conditions after I find the complementary function solution, I get a different answer than applying after I find the full solution $y = y_c + y_p$, where $y_c$ is the complementary one and $y_p$ is the particular solution.
When should I apply the boundary conditions?
You need to find the solution then apply the boudary conditions
$$y'' - y' = x$$ $$y' - y = \frac {x^2}2+K_1$$ $$(ye^{-x})' = e^{-x}\frac {x^2}2+K_1$$ $$ye^{-x}= \int e^{-x}\frac {x^2}2+K_1dx$$ $$ye^{-x}= \int e^{-x}\frac {x^2}2 dx+K_1e^{-x}+K_2$$ $$y= e^{x}\int e^{-x}\frac {x^2}2 dx+K_1+K_2e^{x}$$ $$y= K_1+K_2e^{x}-\frac {x^2}2-x$$
Now you have to apply the boundary conditions
$$ \begin{cases} y(1)=1 \\ y'(1)=2 \end{cases} \implies \begin{cases} K_1+K_2e-3/2=1\\ K_2e-2=2 \end{cases} \implies \begin{cases} K_1=-3/2\\ K_2=4/e \end{cases} $$ $$\boxed {y(x)=4e^{x-1}-\frac {x^2}2-x-\frac 32}$$