All 9 questions UPSC has asked on numerical solution of ordinary differential equations in the Mathematics Optional (Paper II, Numerical Analysis and Computer Programming) from 2009 to 2026, solved step by step – latest first.
Try them yourself first: the same questions, without solutions, are on our Numerical Analysis and Computer Programming topic-wise PYQs page.
How we check these solutions
These are our own solutions, prepared with AI help. UPSC does not publish official answers. Every solution is checked a second way before it goes up, and says how:
- ✓ Checked by computer the answer was worked out again independently with Python: each iteration, table or conversion was run again in double precision (or exact fractions), and algorithms were run on test equations.
- ✓ Proof checked step by step for “prove that” questions, every step was checked against the definitions.
Spotted a mistake or a neater method? Tell us in the comments below or through Report an error.
Jump to a question (year · question number):
2026 · 8b 2023 · 5b 2022 · 8b 2019 · 5d 2015 · 7b 2014 · 6c 2013 · 7b 2012 · 5c 2009 · 7c
Consider the initial value problem : , , (Step-size) (i) Apply the classical fourth order Runge-Kutta method to approximate the solution . (ii) Use Euler’s method to find and .
Solution
Here , , , .
(i) Runge–Kutta (fourth order).
(ii) Euler’s method, :
| 0 | 1 | 1.0000 | 2.0000 | 3.0000 |
| 1 | 2 | 3.0000 | 2.5000 | 5.5000 |
So and .
Comparison. The exact solution of this linear equation is , giving and . Even with the large step , RK4 is within about of the true , while Euler’s method is off by about at and at .
✓ Checked by computer We checked by computer: the exact solution is , so and ; the RK4 and Euler values are as computed.
Given with initial condition at . Find the value of for by Euler’s method, correct to 4 decimal places, taking step length .
Solution
, , , . Euler: .
| 0 | 0.0 | 1.0000 | 1.0000 | 1.1000 |
| 1 | 0.1 | 1.1000 | 0.8473 | 1.1847 |
| 2 | 0.2 | 1.1847 | 0.7506 | 1.2598 |
| 3 | 0.3 | 1.2598 | 0.6820 | 1.3280 |
✓ Checked by computer We reran Euler’s method in Python: . (A fine-step RK4 solution gives , showing the size of Euler’s error.)
Using Runge-Kutta method of fourth order, solve the differential equation with , at . Use four decimal places for calculation and step length 0.1.
Solution
, , , .
The classical fourth-order Runge–Kutta step from is
Step 1: , , so .
Step 2: , , so .
So
✓ Checked by computer We checked by computer: the RK4 steps give , ; a very fine-step solution gives .
Using Runge-Kutta method of fourth order, solve with at . Use four decimal places for calculation and step length 0.2.
Solution
, , , (one step).
The classical fourth-order Runge–Kutta step from is
Step 1: , , so .
✓ Checked by computer We checked by computer: one RK4 step gives ; a fine-step solution gives .
Solve the initial value problem , in the interval using the Runge-Kutta fourth-order method with step size .
Solution
, , , ; two steps reach .
The classical fourth-order Runge–Kutta step from is
Step 1: , , so .
Step 2: , , so .
So and
✓ Checked by computer We checked by computer: RK4 with gives , ; a fine-step solution gives .
Use Runge-Kutta formula of fourth order to find the value of at , where , . Take the step length .
Solution
, , , ; two steps reach .
The classical fourth-order Runge–Kutta step from is
Step 1: , , so .
Step 2: , , so .
✓ Checked by computer We checked by computer: RK4 gives , ; a fine-step solution gives .
Use Euler’s method with step size to compute the approximate value of , correct up to five decimal places from the initial value problem
Solution
, , , ; four steps reach .
| 0 | 0.00 | 2.00000 | −2.00000 | 1.70000 |
| 1 | 0.15 | 1.70000 | −1.72250 | 1.44162 |
| 2 | 0.30 | 1.44162 | −1.47751 | 1.22000 |
| 3 | 0.45 | 1.22000 | −1.24850 | 1.03272 |
(Euler’s method is only first-order accurate, so this approximates the true solution only roughly; the arithmetic of the method is carried to five decimals as asked.)
✓ Checked by computer We reran Euler’s method in Python: .
Provide a computer algorithm to solve an ordinary differential equation in the interval for number of discrete points, where the initial value is , using Euler’s method.
Solution
Euler’s method. Divide into equal steps , . Starting from , for . (This follows the tangent line at for one step; the local error is , the global error .)
ALGORITHM Euler's method for dy/dx = f(x, y), y(a) = alpha, on [a, b]
Input : a, b, alpha, n (number of steps, so there are n+1 points)
1. h = (b - a)/n
2. x = a; y = alpha
3. Print x, y
4. For i = 1 to n do
y = y + h*f(x, y) (Euler step: uses the slope at the left end)
x = a + i*h (computed from a to avoid round-off build-up)
Print x, y
end for
5. Stop
A program would define f(x, y) as a separate function so that the same algorithm works for any equation.
✓ Checked by computer We ran the algorithm in Python on , on : with it prints (), and the error falls roughly in proportion to as grows.
Find the value of using Runge-Kutta fourth order method with step size from the initial value problem :
Solution
, , , (one step).
The classical fourth-order Runge–Kutta step from is
(Exact: , so .)
✓ Checked by computer We checked by computer: one RK4 step gives ; the exact solution gives .
More on Numerical Analysis and Computer Programming
- Numerical Analysis and Computer Programming topic-wise PYQs (questions only, for practice)
- Mathematics PYQ analysis: which units carry the marks year by year
- Year-wise question papers
- Mathematics booklist
Questions: UPSC Civil Services (Main) Examination, Mathematics Paper II, 2009–2026. Solutions: Optional Province. Found an error? Tell us.

