Consider a particle of mass m moving in a potential energy function U(x) = ½kx2
The force on the particle is given by F(x) = -dU(x)/dx = -kx.
The motion of the classical particle is governed by Newton’s second law md2x/dt2 = -kx.
The general solution to this equation is x = xMcos(ωt + φ), with ω2 = k/m.
We have dx/dt = -ωxMsin(ωt + φ),  T = ½m(dx/dt)2 = ½mω2xM2sin2(ωt + φ),
E = T + U = ½mω2xM2sin2(ωt + φ) + ½mω2xM2cos2(ωt + φ) = ½mω2xM2.
The total energy is independent of time, we have a conservative system.

To make the transition to Quantum Mechanics we express E in terms of p and x and then replace the classical quantities p and x by their corresponding quantum mechanical operators P and X.
E = T + U = ½p2/m + ½mω2x2 --> H = ½P2/m + ½mω2X2.

Finding the eigenvalues of H
Define scaled operators Xs and Ps.
Xs = (mω/ħ)1/2X,  Ps =  (mωħ)-1/2P.
H = ½ħω[Ps2 + Xs2] = ħωHs,
where H and Hs have the same eigenstates, but their eigenvalues differ by a factor of ħω.
Xs and Ps do not commute,
[Xs,Ps] = (mω/ħ)1/2(mωħ)-1[X,P] = i.

Let us define some new operators and investigate their properties. Define
a = (2)-1/2(Xs + iPs), and its adjoint, a = (2)-1/2(Xs - iPs).
Then Xs = (2)-1/2(a + a),  PS = i(2)-1/2(a - a).
Note that a and a do not commute.
[a,a] = ½[(Xs + iPs), Xs - iPs)] = ½[-i[Xs,Ps] + i[Ps,Xs] = ½(1 + 1) = 1.

Now we study the product operator aa.
aa = ½(Xs - iPs)(Xs + iPs) = ½(Xs2 + Ps2  + iXsPs - iPsXs) =  ½(Xs2 + Ps2  - 1).
Similarly, aa = ½(Xs2 + Ps2  + 1).
We may therefore write Hs = aa + ½ = aa - ½ = ½(aa + aa).

Define the number operator N = aa.
Then Hs = N + ½.  Hs and N have common eigenstates, finding the eigenstates of N is equivalent to finding the eigenstates of Hs and H.
The operator N does not commute with a and a.
[N,a] = [aa,a] = a[a,a]  + [a,a]a = -a.
[N,a] = [aa,a] = a[a,a]  + [a,a]a = a.

We will now study some of the properties of the eigenstates of N and therefore the eigenstates of  Hs and H.

(a)  The eigenvalues of N are positive.
Proof:  Let |Φν> be an eigenstate of N with eigenvalue ν.
N|Φν> = ν|Φν>.
Find the norm of the vector a|Φν>.
|a|Φν>|2 = <Φν|aa|Φν> = <Φν|N|Φν> = ν<Φνν> ≥ 0,
since the norm is always positive, and <Φνν> ≥ 0  -->  ν ≥ 0.

(b)  If |Φν> is an eigenstate of N with eigenvalue ν ≥ 1 and <Φνν> ≠ 0 then a|Φν> is an eigenstate of N with eigenvalue ν - 1.
If |Φν> is an eigenstate of N with eigenvalue ν < 1 then ν = 0 and a|Φν> = a|Φ0> = 0.
Proof:  |a|Φν>|2 =  ν > 0, unless ν = 0.
[N,a]|Φν> = -a|Φν>.  Na|Φν> = aNΦν> - a|Φν> = (ν - 1)a|Φν>.
a|Φν> is an eigenstate of N with eigenvalue ν - 1.
a|Φν> is non zero unless ν = 0.  But the eigenvalues have to be positive.  Therefore if ν < 1 we need a|Φν> = 0 which requires ν = 0.

(c)  If |Φν> is an eigenstate of N with eigenvalue ν ≥ 0 and <Φνν> ≠ 0 then aν> is an eigenstate of N with eigenvalue ν + 1.
Proof: | aν>|2 = <Φν|aaν> = <Φν|aa + 1|Φν> = (ν + 1)<Φνν> > 0.
[N,a]|Φν> = aν>,  Naν> = aN|Φν> + aν>  = (ν + 1) aν>.

(d)  The eigenvalues of N are the non negative integers.
Proof:  N has at least one non-zero eigenvector with eigenvalue ν.
(It is a Hermitian operator).
N|Φν> = ν|Φν>.
Then |Φν-1> = a|Φν> is also an eigenvector if (ν - 1) > 0,
ν-n> = anν>is also an eigenvector if (ν - n) > 0.
But for some n’ = n + 1 the number ν - n’ will become smaller than zero.
Therefore |Φν-n> must be zero.
But a|Φν-n> is only zero if |Φν-n> = |Φ0> or (ν - n) = 0.
This means that n is a non-negative integer.
If |Φn> is a non-zero eigenvector of N with integer eigenvalue n, then the |Φn’> , n’ = 0, 1, 2, ... are also eigenvectors.  (We can generate these eigenvectors by applying a or a to |Φn> . )
The eigenvectors of N are {|Φn> } with eigenvalues {n}, where n is a non-negative integer.
The eigenvectors of Hs are {|Φn> } with eigenvalues {n + ½}.
The eigenvectors of H are {|Φn> } with eigenvalues {(n + ½)ħω}.
The energy of the harmonic oscillator is quantized.
The ground state energy is ½ħω. The energy levels are evenly spaced.

(e)  The ground state of N or Hs or H is not degenerate.
Proof:  N|Φ0> = 0,  a|Φ0> = 0,  (2)-1/2(Xs + iPs)|Φ0> = 0,
(2)-1/2((mω/ħ)1/2X + i(mωħ)-1/2P)|Φ0> = 0.
(mωX + iP)|Φ0> = 0.  In the {|x>} representation this becomes
mω<x|X|Φ0> + i<x|P|Φ0> = 0,  mωx<x|Φ0> + i((ħ/i)∂/∂x)<x|P|Φ0> = 0,
(mωx/ħ)Φ0(x) + ∂/∂x)Φ0(x) = 0,
Φ0(x) = Cexp(-½mωx2/ħ)
is the solution to this first order differential equation.  It is unique up to a multiplicative constant C.  Therefore there exists only one normalized Φ0(x) and |Φ0> with the eigenvalue 0.  The eigenstate corresponding to the lowest eigenvalue of  N or Hs or H  is not degenerate.
By induction we can now proof that all eigenstates of  N or Hs or H are not degenerate.

The eigenvectors {|Φn> } of  N or Hs or H are a basis for the state space Ex of a particle in a one dimensional problem.  The |Φn> are orthogonal since all eigenvalues are not degenerate.  We now want to choose a normalized set {|Φn> }.

• Assume |Φ0> is normalized, <Φ00> = 1.
The normalized vector |Φ1> is |Φ1> = c1a0>.
If <Φ11> = 1, then |c1|20|aa0> = |c1|20|aa + 1|Φ0> = |c1|2  = 1.
Therefore |Φ1> = a0>.
• The normalized vector |Φn> is |Φn> = cnan-1>.
• If <Φnn> = 1, then |cn|2n-1|aan-1> = |cn|2n-1|aa + 1|Φn-1> = n|cn|2  = 1.
Therefore |Φn> = n-1/2an-1>,
n> = n-1/2(n-1)-1/2(a)2n-2> = n-1/2(n-1)-1/2 ... 2-1/2(a)n0>

The set {|Φn> = (n!)-1/2(a)n0>} forms an orthonormal basis for Ex.
nn'> = δn,n',  ∑nn><Φn| = I.
Let {|Φn>} denote this orthonormal eigenbasis of the operator H = ½P2/m + ½mω2X2.
H|Φn> = (n + ½)ħω|Φn>.

• The results of operating with a or a on |Φn> are given by
a|Φn> = √(n) |Φn-1>,  an> = √(n+1) |Φn+1>.

The matrices representing a and a in the {|Φn>} basis therefore are

The order of the basis vectors is (|Φ0>, |Φ1>, |Φ2>, ...),
n|a|Φn'> = √(n') δn,n'-1,   <Φn|an''> = √(n'+1) δn,n'+1.

• In terms of a and a the observables X an P are given by
X = (ħ/(2mω))1/2(a + a),  P = i(mħω/2)1/2(a - a).
The matrices representing X and P therefore are

X and P are Hermitian operators.