Should I apply boundary conditions in the general solution before finding the particular solution?

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}$$

You wait until you have found the general solution including the particular solution and then you apply the initial or boundary conditions.

Even if the particular solution does not depend on the initial or boundary conditions, you still need to include it in your general solution before finding your constants.

Hint: make the ansatz $$y_p=Ax^2+Bx+C$$ for the particular solution.

You should apply the boundary conditions to the general solution that you have already determined: $$y(x)=\underbrace{C_1+C_2e^x}_{y_o}+\underbrace{-\frac{x^2}{2}-x}_{y_p}.$$ So it remains to find $C_1$ and $C_2$ such that $y(1)=1$ and $y'(1)=2$.