UPSC 2018 Maths Optional Paper 2 Q5e — Step-by-Step Solution
10 marks · Section B
Question
Write down the basic algorithm for solving the equation by bisection method, correct to 4 decimal places.
Technique
Bisection (interval halving) with a sign-change bracket; iteration count fixed by .
Solution
Setup. Let . Then and , so by the Intermediate Value Theorem a root lies in . is continuous and strictly increasing on (), so the root is unique. Bisection repeatedly halves the bracketing interval, keeping the half on which changes sign.
Step 1 — Stopping criterion for 4-decimal accuracy
After bisections the bracket has length . For the error to be below :
So 15 iterations guarantee 4-decimal accuracy; equivalently iterate until .
Step 2 — The algorithm (pseudocode)
ALGORITHM Bisection — solve f(x) = x*e^x - 1 = 0 to 4 dp
INPUT : f(x) = x*e^x - 1, a = 0, b = 1, tol = 0.5e-4 (or maxit = 15)
STEP 1. Compute fa = f(a), fb = f(b).
IF fa * fb > 0 THEN STOP ("no sign change — no root bracketed").
STEP 2. REPEAT
c <- (a + b) / 2 // midpoint
fc <- f(c)
IF fc = 0 OR (b - a)/2 < tol THEN
OUTPUT c ; STOP // root found to required accuracy
END IF
IF fa * fc < 0 THEN
b <- c ; fb <- fc // root in left half
ELSE
a <- c ; fa <- fc // root in right half
END IF
UNTIL (b - a) < 1e-4 (i.e. after at most 15 iterations)
STEP 3. OUTPUT root ≈ (a + b)/2 rounded to 4 decimal places.
Step 3 — Worked outcome
Carrying out the iteration converges to the root
Verification
python3: bisection on f(x)=x*e^x-1, [0,1], 15 iterations
iter 1 c=0.50000 f<0 -> a=0.5
iter 5 c=0.56250 f<0
iter 10 c=0.56714
iter 15 c=0.56714 -> root = 0.5671 (4 dp)
cross-check f(0.5671) = 0.5671*e^0.5671 - 1 = -2.4e-5 ≈ 0 ✓
scipy/known value: Omega constant W(1) = 0.5671432904... ✓