Method of Undetermined Coefficients Differential Equation So the question is to solve this differential equation:
 $y'' - 4y' + 5y = 1 + t$.
I've got the general solution to $\ C_1e^{2t}\cos(2t) + C_2e^{2t}\sin(2t) $
However, I don't really know how to proceed with the particular solution.
I know that t is a polynomial of the first degree and should be written as $At + B$. After that I'm pretty much stuck. One particular question I have though, should $1$ be a constant $D$ which would make the equation for the particular solution: $y = At + B + D$? Or is that redundant since we already have the constant $B$?
As you see, my main concern is how handle the "set-up" of the particular solution.
Follow up question: Is it some general rule to follow when setting up these particular solutions? I'm feeling pretty lost and want to really learn the concept.
 A: make for the particular solution the ansatz $$y_p=At^2+Bt+C$$
A: The method of undetermined coefficients has been called 'educated guesswork' for finding particular solutions. One attempts trial solutions based on the form of the right-hand-side (RHS), bearing in mind the form of the complementary function.
In this case, the RHS is a polynomial of degree 1, and as it does not appear in your complementary function, you pick a trial solution as a polynomial of degree 1 i.e. $y_P=At+B$. Just one additive constant.
Note there are other, more systematic, methods for solving these problems such as variation of parameters.
A: First, your homogeneous solution contains a mistake. It should be:
$$y_h = C_1e^{2t}\cos(t) + C_2e^{2t}\sin(t)$$

Now, this equation allows for a simple particular solution, but a more general way to find a particular solution is making one of the constants depend on $t$ and substituting this into the equation:
$$y_p=C(t)e^{2t}\cos(t)=C y_0$$
Where:
$$y_0''-4y_0'+5y_0=0$$

$$y_p'= C'y_0+Cy_0'$$
$$y_p''= C''y_0+2C'y_0'+Cy_0''$$
Now substitute into the original equation:
$$C''y_0+2C'y_0'+\color{blue}{Cy_0''}-4(C'y_0+\color{blue}{Cy_0'})+\color{blue}{5C y_0}=t+1$$
The sum of the blue parts is equal to $0$ by definition so our equation becomes:
$$y_0 C''+2(y_0'-2y_0)C'-t-1=0$$
or:
$$e^{2t} \cos t~ C''-2 e^{2t} \sin t~ C'-t-1=0$$
Making a substitution:
$$C'(t)=f(t)$$
$$e^{2t} \cos t~ f'-2 e^{2t} \sin t~ f-t-1=0$$
And we obtained a 1st order ODE, which can be solved and in the end get us $C(t)$ and consequently, $y_p(t)$.
The solution is simple in this case, as the homogeneous equation becomes:
$$f_h'-2 \tan t~ f_h=0$$
$$f_h(t)=\frac{A}{\cos^2 t}$$
Now again, we make $A$ depend on $t$:
$$f_p(t)=\frac{A(t)}{\cos^2 t}=A f_0$$
So we find the general solution for $f(t)$, which we then integrate to find $C(t)$ and our particular solution $y_p(t)$ is known.

Again, for this case it doesn't make sense to use this complicated procedure, but for the more general case of inhomogeneous equations this is a sure way to obtain a solution.
