In the chain A→B→C of binary variables, P(A=1)=0.3, P(B=1∣A=1)=0.8, P(B=1∣A=0)=0.1, P(C=1∣B=1)=0.9 and P(C=1∣B=0)=0.2. Use variable elimination to find P(C=1). Why is this cheaper than summing the full joint?

Probabilistic models, Exact inference
Level L2 Elementary. Length Medium. Nature Mat Mathematical.

What's being asked

Whether you can push sums inside products and carry the intermediate factors.

Key idea

Write P(C)=∑BP(C∣B)∑AP(A) P(B∣A). Eliminate A first to get a factor τ(B), then eliminate B.

Steps

  1. Start from P(C)=∑A,BP(A) P(B∣A) P(C∣B) and move the sum over A inside: P(C)=∑BP(C∣B) τ(B) with τ(B)=∑AP(A) P(B∣A).
  2. τ(B=1)=0.3⋅0.8+0.7⋅0.1=0.24+0.07=0.31, and so τ(B=0)=0.69. This is just P(B).
  3. P(C=1)=τ(B=1)⋅0.9+τ(B=0)⋅0.2=0.31⋅0.9+0.69⋅0.2=0.279+0.138=0.417.
  4. Hence P(C=0)=0.583. The two values sum to 1, which is a useful check.
  5. Cost: the full joint has 23=8 terms. In a chain of n variables with k states, elimination costs O(nk2), whereas the joint costs kn.

Common mistakes

How long your answer should be

Half a page, showing τ(B).

Last checked on 4 December 2026.

Read this

Previous in Probabilistic models: In the DAG with edges A→C, B→C, C→D and C→E, decide whether each statement is true, using d-separation: (i) A⊥B; (ii) A⊥B∣D; (iii) A⊥D∣C; (iv) D⊥E∣C; (v) D⊥E; (vi) A⊥E∣B?
Next in Probabilistic models: You use a Metropolis random-walk sampler for the unnormalised target p~(x)=e−x2/2. The current state is x=1. Find the acceptance probability for the proposals x′=−0.5 and x′=2. If the uniform random number is u=0.3 for x′=2, is it accepted? Why is the normalising constant not needed?