Are solutions to a second order differential equation unique in this case? In my math book, a general solution to the differential equation $y'' + y = f(t)$ where $f(t)$ is continuous on $(-\infty, \infty)$ is given by $y = A\cos t + B\sin t + \int_0^t f(s)\sin(t-s)ds$.
Taking as an example $y'' + y = t$, I get the following result when I use undetermined coefficients: $y = A\cos t + B\sin t + t$
When I use the formula given above, I get $y = A\cos t + B\sin t + t - \sin t$
Both solutions also work when you plug them back into $y'' + y = t$, so is this to say that both solutions are valid and the only difference would be in the values of the constants?
 A: Short answer: yes, both are valid.
Long answer.  A function with undetermined coefficients is not a single function, but a family of functions. Two families (sets) are equal if every member  of the first family is also a member of the second, and the other way around. For example, the families {Jane, Joe, their son} and {Bobby, his Dad, his Mom} may be the same though the members are listed in different order and described in  different ways. 
In your example:


*

*Every member of the second family of functions is of the form  $y = A\cos t + B\sin t + t-\sin t$ with some numbers $A,B$. This function can also be written as  $y = A\cos t + (B-1)\sin t + t $. Therefore, it also belongs to the first family. 

*Every member of the first family is of the form $y = A\cos t + B\sin t + t$. This can be written as  $y = A\cos t + \tilde {B}\sin t + t-\sin t$ by choosing $\tilde B=B+1$. Therefore, $y$ belongs to the second family.

The first time one encounters this situation is in  integral Calculus, where $+C$ is used to describe families of antiderivatives. For example, one can write 
$$
\int \frac{1}{x}\,dx = \ln |x| +C
$$ or $$
\int \frac{1}{x}\,dx =  \int \frac{2}{2x}\,dx \overset{\color{Red}{u=2x}}{=} \int \int \frac{1}{u}\,du = \ln|u|+C=\ln|2x|+C
$$
Both are the same family of functions. 
A: This will help if you have studied linear algebra before. Usually in that class you work with finite-dimensional vector spaces in one guise or another: $\mathbf{R}^n$ with standard addition and scalar multiplication. You have seen linear transformations, and these have kernels.  Usually, you think about them in terms of matrices, but forget about those.
Now, let's consider the $\mathrm{C}^\infty$ functions; functions defined on all of $\mathbf{R}$ that are infinitely differentiable, together with addition and multiplication by real constants. These functions form a vector space. Now, consider the operator $\mathrm L$ defined by $\mathrm Lu = u'' + u.$  This is a map from $\mathrm{C}^\infty \rightarrow \mathrm{C}^\infty.$ It has a kernel: the linear combinations of the cosine and the sine functions. So, if $\mathrm Lu = f$ and $\mathrm Lv = 0$, then $\mathrm L(u+v) = f$ too, just as $\mathbf{Au} = \mathbf{x}$ and $\mathbf{Av} = \mathbf0$ imply $\mathbf{A(u+v)} = \mathbf x$.  One solution becomes a whole set of solutions.
