Problem 3

Part a

We know the recipe; Expand the given wavefunction in terms of the spherical harmonics (Subscript[Y, l]^m)(θ,ϕ) i.e. write

f(θ,ϕ) = (∑_(l=0)^∞)(∑_(m=-l)^l)(Subscript[C, lm])(Subscript[Y, l]^m)(θ,ϕ)

where the expansion coefficients ((Subscript[c, lm])) are given by: 

(Subscript[c, lm]) = (∫_0^(2π))(∫_0^π)f(θ,ϕ)(Subscript[Y, l]^(SuperStar[m]))(θ,ϕ)sin(θ)dθdϕ

Using the definition of Heaviside step functions (U or Θ) we can convert our piecewise function to a more traditional function defined on the domain of (Subscript[Y, l]^m)(θ,ϕ) (where 0 < θ < π and 0 < ϕ < 2π).
Note, this step is NOT necessary at all. You can do piecewise integration and nothing would change. 

f(θ,ϕ) = N (((π^2)/4)-(θ^2))*Θ(θ-0) + (-N (((π^2)/4)-(θ^2))*Θ(θ-(π/2)))   

In English, we are turning on our function f (θ,ϕ)  at θ = 0 and then we are turning on the “negative” of the function at θ = (π/2) or more simply we turn off the function at θ = (π/2) by putting a negative sign. 

With this setup, we can use Mathematica to find the expansion coefficients.

n= (1/(Sqrt[((π^5)/8)+2(π^3)-24(π^2)+48π]))
f[θ_,ϕ_]:=n(((π^2)/4)-(θ^2))*HeavisideTheta[θ-0]-n(((π^2)/4)-(θ^2))*HeavisideTheta[θ-(π/2)]

c[l_,m_]:=(∫_0^(2π))(∫_0^π)f[θ,ϕ]*Conjugate[SphericalHarmonicY[l,m,θ,ϕ]]*Sin[θ]\[DifferentialD]θ\[DifferentialD]ϕ

Now we have a code that will give us the expansion coefficient for a given harmonic.
The question is asking for:

1. (Subscript[C, 00]) (i.e. the coefficient that goes with (Subscript[Y, 0]^0)(θ,ϕ) term i.e. (Ket[0,0]))
2. (Subscript[C, 1,-1])(i.e. the coefficient that goes with (Subscript[Y, 1]^(-1))(θ,ϕ) term i.e. (Ket[1,-1]))
3. (Subscript[C, 1,0]) (i.e. the coefficient that goes with (Subscript[Y, 1]^0)(θ,ϕ) term i.e. (Ket[1,0]))
4. (Subscript[C, 1,1]) (i.e. the coefficient that goes with (Subscript[Y, 1]^1)(θ,ϕ) term i.e. (Ket[1,1]))

Let’s tell Mathematica to give us the coefficients:

c[0,0]//N
c[1,-1]//N
c[1,0]//N
c[1,1]//N

There we go, we have all our coefficients ((Subscript[C, lm])):
(Subscript[C, 00]) = 0.624
(Subscript[C, 1,-1 ])= 0
(Subscript[C, 1,0]) = 0.706
(Subscript[C, 1,1]) = 0

Part b

If we measure the (L^2) for a particle on a sphere to be 2(ℏ^2), then that implies that l=1 as (L^2)(Ket[l,m]) = (ℏ^2)l(l+1) (Ket[l,m])
Therefore, 
(Subscript[P, (L^2) = 2(ℏ^2)]) =(∑_(m=-1)^1)|(BraKet[1,m, f(θ,ϕ)])((|)^2) = |(BraKet[1,-1, f(θ,ϕ)])((|)^2) +|(BraKet[1,0, f(θ,ϕ)])((|)^2) +|(BraKet[1,-1, f(θ,ϕ)])((|)^2) = |(Subscript[c, 1,-1])((|)^2)+|(Subscript[c, 1,0])((|)^2)+|(Subscript[c, 1,1])((|)^2) = (0.706^2) = 0.499   

There’s no way one could measure (L^2)  to be 4(ℏ^2) as that would imply that l is not an integer (which it should be). Hence, (Subscript[P, (L^2) = 4(ℏ^2)]) =0

Part c

To find the probability of finding the particle in a given region, we must first find the probability density. Probability density is simply (SuperStar[ψ])ψ or |ψ((|)^2). Here, since our wavefunction f(θ,ϕ) is normalized, we can directly use it to compute the probability density and don’t have to use the “spherical harmonic expanded function” 
Therefore, probability density = (SuperStar[f(θ,ϕ)])f(θ,ϕ) = ((f(θ,ϕ))^2)  as our function is all real. Let’s tell Mathematica to calculate the probability density.

probdensity= (((n(((π^2)/4)-(θ^2))*HeavisideTheta[θ-0]-n(((π^2)/4)-(θ^2))*HeavisideTheta[θ-(π/2)]))^2)

Once, we have our probability density we can integrate over the desired region to find the probability. BE CAREFUL, YOU’RE INTEGRATING OVER A SPHERE, SO THE VOLUME ELEMENT IS sinθdθdϕ and not just dθdϕ. THE FACTOR OF Sinθ IS CRITICAL!!!.

(∫_0^(π/6))(∫_0^(π/6))probdensity*Sin[θ]\[DifferentialD]θ\[DifferentialD]ϕ//N

(∫_0^(π/6))(∫_(5(π/6))^π)probdensity*Sin[θ]\[DifferentialD]θ\[DifferentialD]ϕ//N

Therefore, the probability of finding the particle in the region: {0 ≤ ϕ ≤ (π/6) and 0 ≤ θ ≤ (π/6)} is roughly 2.7% and to find it in the region: {0 ≤ ϕ ≤ (π/6) and ((5π)/6) ≤ θ ≤ π} is 0. Let’s plot to see if it makes sense.

F[θ_,ϕ_]:=c[0,0]*SphericalHarmonicY[0,0,θ,ϕ]+c[1,0]*SphericalHarmonicY[1,0,θ,ϕ]
F[θ,ϕ]

Plot[{((f[θ,0])^2),(((((8+(-4+π) π)/(2 (Sqrt[π (768+2 π (-192+16 π+(π^3)))])))+((3 (4+(π^2)) Cos[θ])/(8 (Sqrt[2 π (384-192 π+16 (π^2)+(π^4))])))))^2)},{θ,0, π},PlotLabel->"Probability density",AxesLabel->{"θ", "Prob Density"},PlotLabels->{"Actual function","approximated function"},ImageSize->Large]