Proof that the real vector space of $C^\infty$ functions with $f''(x) + f(x) = 0$ is two-dimensional 
Prove that the real vector space of $C^\infty$ functions $f$ such that $$f''(x) + f(x) = 0$$ is two-dimensional.

I feel like there must be an obvious answer to this question, but I don't know what it is. In particular, I can see that $\sin(x)$ and $\cos(x)$ are linearly independent, but how do I know that they span the space?
If we restrict the problem to analytic functions, then two-dimensionality is easy: once you know the values of $f(0)$ and $f'(0)$, the rest of the Maclaurin series follows from the identity $f^{(n+2)}(0) = -f^{(n)}(0)$ for all $n$. But how do we know there are no non-analytic solutions?
Before you ask: this isn't quite a homework question. I'm going to present this example as an algebra TA, and I'd like some confidence that my answer is actually rue.
 A: 
I shall prove a general statement.  Let $p(t)\in\mathbb{C}[t]$ be a monic polynomial of degree $n\in\mathbb{Z}_{>0}$ and suppose that $V:=\mathcal{C}^\infty(\Omega,\mathbb{C})$ is the $\mathbb{C}$-vector space of complex-valued functions on $\Omega$, where $\Omega$ is a nonempty connected open set of $\mathbb{R}$.  Write $D:V\to V$ for the differentiation map:
$$\big(D(f)\big)(x):=f'(x)=\left.\left(\frac{\text{d}}{\text{d}u}f(u)\right)\right|_{u=x}$$
for all $x\in \Omega$.  Then, $\ker\big(p(D)\big)$ is an $n$-dimensional $\mathbb{C}$-vector subspace of $V$.  (Even more generally, if $\Omega$ is an open set of $\mathbb{R}$ with $c$ connected components, then $\ker\big(p(D)\big)$ is $cn$-dimensional over $\mathbb{C}$.  Also, $V$ can be replaced by the space of holomorphic functions on $\Omega$, if $\Omega$ is taken to be an open subset of $\mathbb{C}$.)

First, write $p(t)=\prod_{i=1}^k\,\left(t-z_i\right)^{m_i}$, where $z_1,z_2,\ldots,z_k\in\mathbb{C}$ are pairwise distinct, and $m_1,m_2,\ldots,m_k\in\mathbb{Z}_{>0}$.  Define
$$p_i(t):=\left(t-z_i\right)^{m_i}\text{ and }q_i(t):=\frac{p(t)}{p_i(t)}\,.$$
Then, the fact that
$$p(t)=p_i(t)\,q_i(t)\text{ and }p_i(t)\,f_i(t)+q_i(t)\,g_i(t)=1$$
for some $f_i(t),g_i(t)\in\mathbb{C}[t]$ implies that
$$\ker\big(p(D)\big)=\ker\big(p_i(D)\big)\oplus \ker\big(q_i(D)\big)\,.$$
By induction, we see that
$$\ker\big(p(D)\big)=\bigoplus_{i=1}^k\,\ker\big(p_i(D)\big)\,.$$
Thus, it boils down to studying $\ker\big(p(D)\big)$, where $p(t)=(t-z)^m$ for some $z\in\mathbb{C}$ and $m\in\mathbb{Z}_{>0}$.  However, consider the map $M_z:V\to V$ given by
$$\big(M_z(f)\big)(x):=\exp(zx)\,f(x)$$
for all $x\in \Omega$.  As
$$p(D)=M_z\,D^m\,M_{-z}=M_z\,D^m\,\left(M_z\right)^{-1}\,,$$
$p(D)$ and $D^m$ are conjugate linear maps.  Therefore,
$$\ker\big(p(D)\big)=M_z\big(\ker\left(D^m\right)\big)\,.$$
Since $\ker\left(D^m\right)$ is $m$-dimensional and $M_z$ is a vector-space automorphism,
$$\dim\Big(\ker\big(p(D)\big)\Big)=\dim\Big(\ker\big(D^m\big)\Big)=m\,.$$
In fact, $\ker\big(p(D)\big)$ consists of elements of the form $M_z(f)$, where $f:\Omega\to\mathbb{C}$ is a polynomial function of degree less than $m$.

Alternatively, let $U:=\ker\big(p(D)\big)$.  Then, show that $p(t)$ is the minimal polynomial of $D|_U:U\to U$.  From my post here, $U$ decomposes as
$$U=\bigoplus_{i=1}^m\,\ker\left(\big(D-z_i\,\text{id}_U\big)^{m_i}\right)\,,$$
if $p(t)=\prod_{i=1}^k\,\left(t-z_i\right)^{m_i}$.

Let $\mathcal{V}$ denote the $\mathbb{C}$-vector space of $\mathbb{C}$-valued sequences $\left(X_N\right)_{N\in\mathbb{Z}_{\geq 0}}$.  Fix $a_0,a_1,\ldots,a_{n-1}\in\mathbb{C}$.  The same technique can be employed to show that the solutions $\left(X_N\right)_{N\in\mathbb{Z}_{\geq 0}}\in\mathcal{V}$ of a recurrence relation
$$X_{N+n}+a_{n-1}\,X_{N+n-1}+\ldots+a_1\,X_{N+1}+a_0\,X_N=0$$
for all $N\in\mathbb{Z}_{\geq 0}$ form an $n$-dimensional $\mathbb{C}$-vector subspace of $\mathcal{V}$.

P.S.: If you want to consider $V_\mathbb{R}:=\mathcal{C}^\infty(\Omega,\mathbb{R})$ instead, then use the fact that $V=\mathbb{C}\underset{\mathbb{R}}{\otimes} V_{\mathbb{R}}$.  That is, if $p(t)\in\mathbb{R}[t]$, then the kernel $K_\mathbb{R}$ of $\big.p(D)\big|_{V_\mathbb{R}}:V_\mathbb{R}\to V_\mathbb{R}$  satisfies $$\mathbb{C}\underset{\mathbb{R}}{\otimes} K_\mathbb{R}=\ker\big(p(D)\big)\,.$$
A: HINT: Show that the function
$$ \mathbb{R} \ni t \mapsto \left (\matrix {\cos t & - \sin t \\ \sin t & \cos t } \right )\cdot \left ( \matrix{ f(t) \\ f'(t) } \right ) \in \mathbb{R}^2$$ is constant
$\bf{Added:}$
Let's show that if $n$ solutions of the linear equation $y'(t) = A(t) y(t)$  have an invertible Wronskian $W(t)$,  and $f$ is another solution  then $f(t)$ is a linear combination of these solutions. Recall that the columns of $W$ are these $n$ solutions, so we have $W'(t) = A(t) W(t)$.
Indeed, consider the function
$$t\mapsto W(t)^{-1} f(t)$$
Its derivative equals
$$(W(t)^{-1})' f(t) + W(t)^{-1} f'(t)$$
Now we have
$$(W(t)^{-1})'= - W(t)^{-1} W(t)'  W(t)^{-1} $$
We get
$$(W(t)^{-1})' f(t) + W(t)^{-1} f'(t) = \\=- W(t)^{-1} A(t) W(t) W(t)^{-1} f(t) + W(t)^{-1}  A(t) f(t)= \\
=- W(t)^{-1} A(t) f(t) + W(t)^{-1}  A(t) f(t) = 0$$
Hence the function
$$ W(t)^{-1} f(t) $$ is a constant $c$ (in $\mathbb{R}^n)$ and so
$f(t) = W(t) \cdot c$ is a linear combination of the columns of $W(t)$.
A: Read about the Wronskian. 
For three supposedly linearly independent $C^{\infty}$ solutions $f$ $g$, and $h$, the Wronskian determinant should be nonzero. But since the last row will be $-1$ times the first row, the Wronskian will be $0$. This contradicts the possibility for three independent solutions.
A: Here is an approach that essentially uses reduction of order.
Define $g(x) = f(x)/\cos(x)$, so that $f(x) = g(x) \cos(x)$. Plugging this in to the differential equation yields
$$
0 = f''(x) + f(x) = [\cos(x) g''(x) - 2\sin(x)g'(x) - \cos(x) g(x)] + \cos(x)g(x)\\
= \cos(x) g''(x) - 2 \sin(x) g'(x).
$$
In other words, $h(x) = g'(x)$ solves the differential equation
$$
\cos(x)h'(x) - 2 \sin(x)h(x) = 0 \implies 
h'(x) = 2 \tan(x) h(x).
$$
This is a separable first order differential equation, which we can routinely solve to get
$$
h(x) = C_1 \sec^2(x).
$$
With that, we have
$$
g'(x) = C_1 \sec^2(x) \implies g(x) = C_1 \tan(x) + C_2,
$$
which leads to our solution
$$
f(x) = g(x) \cos(x) = C_1 \sin(x) + C_2 \cos(x),
$$
which was what we wanted.

There are some weaknesses to this approach. Division by $\cos(x)$ means that this is technically only an argument that a solution exists over intervals that exclude the zeros of $\cos(x)$. However, the time-invariant nature of this differential equation means that this existence extends to arbitrary intervals "by symmetry."
Now, we can establish that the solution space is two dimensional by arguing that separable first order differential equations have a one-dimensional solution spaces.
