In Gaussian discriminant analysis with x∣y=k∼N(μk,Σ) (the same Σ for both classes) and P(y=1)=ϕ, show that P(y=1∣x)=σ(w⊤x+b), the logistic function of a linear function of x. Give w and b. For μ0=0, μ1=2, Σ=1, ϕ=0.5 in one dimension, what is P(y=1∣x=1.5)?

Supervised learning, Gaussian discriminant analysis
Level L3 Intermediate. Length Medium. Nature Th+Mat Both.

What's being asked

Whether you can write the log-odds and see that the quadratic terms cancel.

Key idea

ln⁡P(y=1∣x)P(y=0∣x)=w⊤x+b with w=Σ−1(μ1−μ0), so the posterior is a sigmoid.

Steps

  1. Write the log-odds: ln⁡P(y=1∣x)P(y=0∣x)=ln⁡p(x∣1)p(x∣0)+ln⁡ϕ1−ϕ.
  2. Insert the Gaussian densities. The normalising constants are equal (same Σ) and cancel, leaving −12(x−μ1)⊤Σ−1(x−μ1)+12(x−μ0)⊤Σ−1(x−μ0).
  3. Expand. The x⊤Σ−1x terms cancel because Σ is shared. What remains: x⊤Σ−1(μ1−μ0)−12μ1⊤Σ−1μ1+12μ0⊤Σ−1μ0.
  4. So log-odds =w⊤x+b with w=Σ−1(μ1−μ0) and b=−12μ1⊤Σ−1μ1+12μ0⊤Σ−1μ0+ln⁡ϕ1−ϕ.
  5. Since P(y=1∣x)=11+e−log-odds, we get σ(w⊤x+b), the logistic regression form.
  6. Numbers: w=2, b=−12(4)+0+ln⁡1=−2. At x=1.5: wx+b=3−2=1, so P=σ(1)=11+e−1≈0.731. The boundary is at x=1, the midpoint of the means.

Common mistakes

How long your answer should be

Half a page; 5 minutes.

Last checked on 4 December 2026.

Read this

Previous in Supervised learning: For two classes, Fisher's criterion is J(w)=(w⊤(m1−m0))2w⊤SWw, where m0,m1 are the class means and SW is the total within-class scatter matrix. Show that the maximiser is w∝SW−1(m1−m0). How do you check it for m1−m0=(3,2) and SW=diag(2,1)?
Next in Supervised learning: In one dimension, class 1 has density N(0,1) and class 2 has density N(0,4) (variance 4), with equal priors. Where are the Bayes decision boundaries, and which class is chosen in each region? Why is the boundary not a single point?