Particular solution of second order differential equation 
Given the ode: 
  $$
y''-2y'+y=e^t,
$$
  how can I find the form of the particular solution?

At first, I tried the form $y=Ae^t$ but
$$
\begin{split}
&\frac{d^2y}{dt^2}Ae^t=\frac{dy}{dt}Ae^t=Ae^t\\
\\
&Ae^t-2Ae^t+Ae^t=e^t\\
\\
&0=e^t\\
\end{split}.
$$
So this doesn't work.
I also tried the form $y=Ate^t$, but again
$$
\begin{split}
&\frac{d^2y}{dt^2}=A(2e^t+te^t)\\
\\
&\frac{dy}{dt}=A(e^t+te^t)\\
\\
&A(2e^t+te^t)-2A(e^t+te^t)+Ate^t=e^t\\
\\
&2A+At-2A-2At+At=1\\
\end{split}.
$$
and again this doesn't work

Generally, what is the best way to guess the form of the solution?

 A: Hints/Guides on how to solve such differential equations :
$\mathbf{1}$ - Method of Undetermined Coefficients :
Start of by solving the homogenous equation  $y''-2y'+y= 0$ by assuming that a solution will be proportional to $e^{\lambda t}$ for some $\lambda$. Substitute in and calculate $\lambda$. Notice the multiplicity of the solution for $\lambda$ and adjust your general solution accordingly.
Then, use the method of undetermined coefficients to find a particular solution of the problem for $y''-2y'+y=e^t$. 
The general solution of the initial differential equation, will then be the general solution of the homogenous plus the particular solution you found. 
You can find more information and examples about that method, here.
$\mathbf{2}$ - Laplace Transformation :
This is a very fast and straight forward way to approach the problem, but it needs some fluent handling of Laplace Transformation techniques. Note that you can apply the Laplace Transformation without even needing initial conditions, simply stating them as constants.
Start of by applying the Laplace Transformation 
$$\mathcal{L}_t\big[f(t)\big](s) = \int_0^\infty f(t)e^{-st}\mathrm{d}t$$
to both sides of the given differential equation :
$$\mathcal{L}_t\big[y'' - 2y' + y'] = \mathcal{L}_t[e^t]$$
$$\Leftrightarrow$$
$$(s-1)^2\big[\mathcal{L}_t[y(t)](s)\big] - (s-2)y(0) - y'(0) = \frac{1}{s-1}$$
$$\Leftrightarrow$$
$$\mathcal{L}_t\big[y(t)\big](s) = \frac{y(0)(s^2-3s+2) + y'(0)(s-1) + 1}{(s-1)^3}$$
$$=$$
$$\mathcal{L}_t\big[y(t)\big](s) = \frac{1}{(s-1)^3} -  \frac{y(0)}{(s-1)^2} +  \frac{y(0)}{s-1} + \frac{y'(0)}{(s-1)^2} $$
$$\implies$$
$$y(t) = \frac{1}{2}e^t(t^2+2c_1 - 2c_1t + 2c_2t) = \frac{e^tt^2}{2} + c_1e^t - c_1e^tt + c_2e^tt$$
$\mathbf{3}$ - Variation of Parameters :
You must repeat the step of solving the homogenous equation by finding that $\lambda$s mentioned. Then by listing the basis solution as $y_{b_1} = e^t$ and $_{b_2} = e^tt$ you can use variation of parameters to find the final general solution by computing the Wronskian and finding the integrals :
$$v_1(t) = - \int \frac{f(t)y_{b_2}(t)}{W(t)}\mathrm{d}t \quad \text{and} \quad v_2(t) =  \int \frac{f(t)y_{b_1}(t)}{W(t)}\mathrm{d}t$$
You can find more information and examples about that method, here.
A: Both your attempts are in fact right but fail because the fundamental set of solutions for your second order ODE is given by exactly your both guesses for the particular solution. It is not hard to show by using the characteristic equation that the fundamental set of solutions is given by
$$y(t)=c_1e^t+c_2te^t$$
Therefore in this case it is not possible to obtain a particular solution in the standard way hence the inhomogeneous term is in fact part of the solution.
Howsoever you second try was near the actual solution. Since both terms $e^t$ and $te^t$ did not worked out hence there are part of the solution you could further consider $t^2e^t$ as the next try. It turns out that this yields to the solution $($see here$)$. 
This leads to the conjecture that at least for a inhomogeneous term of the form $Ae^{bt}$ you just have to try the specific exponential with different powers of the variable infront as particular solution until it works out.
A: Edit: I misunderstood the question of the OP and I did not posted an answer on how to solve a general non homogeneous linear constant coefficients ODE: I explained how to find the sometimes called particular solution, i.e. a solution $y_p$ of equation \eqref{1} which, added to a solution $y_o$ of the associated homogeneous one, solves a given Cauchy problem. However, since someone found it useful, I decided not to remove it and eventually remove some typos/inaccuracies in the text.
I will answer to the question by considering the general $n$-th order constant coefficients linear ODE
$$
\frac{\mathrm{d}^{n}y}{\mathrm{d}t^{n}}+a_{n-1}\frac{\mathrm{d}^{n-1}y}{\mathrm{d}t^{n-1}}+\dots+a_1\frac{\mathrm{d}y}{\mathrm{d}t}+a_0y=f\label{1}\tag{1}
$$
and the associated linear homogeneous equation
$$
\frac{\mathrm{d}^{n}y}{\mathrm{d}t^{n}}+a_{n-1}\frac{\mathrm{d}^{n-1}y}{\mathrm{d}t^{n-1}}+\dots+a_1\frac{\mathrm{d}y}{\mathrm{d}t}+a_0y=0\label{a}\tag{1'}
$$
where $f\not\equiv 0$: the choice $a_n=1$ is only for formal simplification in the development and does not restrict the generality of the analysis.

There are basically two methods for finding a particular solution $y_p$ of the ODE \eqref{1}:
  
  
*
  
*by guessing, based on the solver's experience: this method will not be analyzed here. 
  
*by choosing a solution $y_o$ of the associated homogeneous equation \eqref{a} satisfying
  $$
y_o(0)=y_o^{(1)}(0)=\dots=y_o^{(n-2)}(0)\quad y_o^{(n-1)}(0)=1\label{2}\tag{2}
$$
and forming the fundamental solution $\mathscr{E}$ of \eqref{1}
$$
\mathscr{E}(t)=H(t)y_o(t),\label{3}\tag{3}
$$
  where $H(t)$ is the Heaviside function. Then the sought for particular solution is 
  $$
y_p(t)=\mathscr{E}\ast f(t)=\int\limits_{0}^ty_o(t-s)f(s)\mathrm{d}s \label{4}\tag{4}
$$

Let's apply formula \eqref{4} to the OP problem, before analyzing why it gives the sought for result. Since the characteristic equation is
$$
x^2-2x+1=0\iff x=1 \text{ with multiplicity 2}
$$
we have that a fundamental system of solutions of the homogeneous equation associated to the given one is 
$$
y_1(t)=e^t,\: y_2(t)=te^t\implies y_o=y_2(t)
$$
since it is the only solution satisfying condition \eqref{2}, i.e. $y_o(0)=0$ and $\dfrac{\mathrm{d}}{\mathrm{d}t}y_o(0)=0$. Now we have that
$$
\mathscr{E}(t)=H(t)y_o(t)=H(t)te^t
$$
and by applying \eqref{4} we obtain
$$
\begin{split}
y_p(t)=\mathscr{E}\ast \exp(t)&=\int\limits_{0}^{+\infty}H(t-s)(t-s)e^{t-s}e^s\mathrm{d}s\\
&=\int\limits_{0}^ty_o(t-s)e^s\mathrm{d}s\\
&=\int\limits_{0}^t(t-s)e^{t}\mathrm{d}s={t^2 \over 2}e^t
\end{split}
$$
which is the sought for particular solution of the ODE proposed as an example.
Why the methods works? Because of the properties of distributions ([1], §4.9, example 4.9.6 pp. 77-74 and §15.4, example 15.4.4): by using these properties and the condition \eqref{2} we have
$$
\begin{split}
\frac{\mathrm{d}}{\mathrm{d}t}\mathscr{E}(t)&=H(t)\frac{\mathrm{d}}{\mathrm{d}t}y_o(t)\\
\frac{\mathrm{d}^2}{\mathrm{d}t^2}\mathscr{E}(t)&=H(t)\frac{\mathrm{d}^2}{\mathrm{d}t^2}y_o(t)\\
&\vdots\\
\frac{\mathrm{d}^n}{\mathrm{d}t^n}\mathscr{E}(t)&=H(t)\frac{\mathrm{d}^n}{\mathrm{d}t^n}y_o(t)+\delta(t)
\end{split}
$$
and thus 
$$
\begin{split}
\frac{\mathrm{d}^n}{\mathrm{d}t^n}\mathscr{E}(t)&+a_{n-1}\frac{\mathrm{d}^{n-1}}{\mathrm{d}t^{n-1}}\mathscr{E}(t)+\dots+a_{1}\frac{\mathrm{d}}{\mathrm{d}t}\mathscr{E}(t)+a_0\mathscr{E}(t)\\
=&H(t)\Big[\frac{\mathrm{d}^n}{\mathrm{d}t^n}y_0(t)+a_{n-1}\frac{\mathrm{d}^{n-1}}{\mathrm{d}t^{n-1}}y_0(t)(t)+\dots+a_{1}\frac{\mathrm{d}}{\mathrm{d}t}y_0(t)+a_0y_0(t)\Big]+\delta(t)=\delta(t)
\end{split}
$$
The linearity of the differential operator and the properties of the Dirac $\delta$-distribution do the rest.
Notes


*

*The analyzed method is perhaps the simplest way to find a particular solution of the ODE proposed by the OP, and more generally of \eqref{1}, because it requires only the knowledge of a complete systems of solutions of the associated equation \eqref{2}. Indeed such a system of solutions is already required to solve any problem (Cauchy, boundary value, etc.) for \eqref{1} and \eqref{3}: the only further operation to do is calculating $y_o$ and the convolution integral \eqref{3}.

*The convolution integral used in \eqref{3} is the standard one used in the operational calculus of one variable functions, i.e.
$$
\mathscr{E}\ast f(t)=\int\limits_0^{+\infty}\mathscr{E}(t-s)f(s)\mathrm{d}s\quad \mathscr{E},f\in L_\mathrm{loc}^1(\mathbb{R}_+)
$$
which can be deduced from the standard one by considering $H(t)f(t)$ instead of $f(t)$ as homogeneous term.

*The assumption $a_n=1$ does not restrict the generality of the above analysis because if we assume that we are dealing with an $n$-th order linear constant coefficient ordinary differential operator, we must assume $a_n\neq 0$.

*The distribution \eqref{3} is called fundamental solution exactly because it can be used to construct the solution for every linear, constant coefficient non-homogeneous ODE.
[1] Vladimirov, V. S. (2002), Methods of the theory of generalized functions, Analytical Methods and Special Functions, 6, London–New York: Taylor & Francis, pp. XII+353, ISBN 0-415-27356-0, MR 2012831, Zbl 1078.46029.
