Ordinary Differential Equations
Level: 3 (Production — from-scratch derivations, code-from-memory, explain-out-loud) Time limit: 45 minutes Total marks: 60
Instructions: Derive from first principles where asked. Show all reasoning. Pseudocode/Python must be written from memory. Use / for mathematics.
Question 1. (10 marks) — Integrating factor, derived from scratch.
Consider the general first-order linear ODE
(a) Derive the integrating factor from scratch, showing exactly what condition must satisfy for the left-hand side to become an exact derivative. (5)
(b) Hence solve the initial value problem (5)
Question 2. (12 marks) — Constant-coefficient theory, all three cases.
For the homogeneous equation :
(a) Explain out loud (in words + algebra) why substituting produces the characteristic equation, and why a repeated root forces a second solution of the form . Give the reduction-of-order derivation of that second solution. (6)
(b) Solve and write the real general solution, showing the Euler's-formula step that removes the complex exponentials. (6)
Question 3. (10 marks) — Laplace transform from the definition.
(a) Starting from the definition , prove that and state the region of convergence. (3)
(b) Prove the derivative property from the definition (integration by parts). (4)
(c) Use the two results above to solve via Laplace transform. (3)
Question 4. (12 marks) — Laplace with discontinuous forcing.
Solve, using Laplace transforms: where is the Heaviside step turning on at .
(a) Transform the equation and solve for . (4) (b) Invert using the second shift theorem; write as a piecewise function. (6) (c) State the value of for in simplified trigonometric form. (2)
Question 5. (10 marks) — Systems, phase plane, stability.
Given the linear system with
(a) Find eigenvalues and eigenvectors and write the general solution. (5) (b) Classify the critical point at the origin (node/saddle/spiral/centre) and state its stability, justifying from the eigenvalue signs. (3) (c) Explain out loud, for a general system, how the trace and determinant of determine the equilibrium type. (2)
Question 6. (6 marks) — Euler's method, code from memory.
(a) Write, from memory, a Python function euler(f, x0, y0, h, n) that returns lists of and values approximating . (4)
(b) For , , , compute by hand the Euler estimate of (two steps) and compare with the exact value . (2)
Answer keyMark scheme & solutions
Question 1
(a) Multiply the ODE by an unknown : We want the LHS to equal . (1) Matching the terms requires This is separable: , (1) Then . (1)
(b) Here , so , . (1) Integrate: . (1) Apply : . (1)
Question 2
(a) For with constant coefficients, derivatives of reproduce times a constant, so the equation collapses to an algebraic one: Since , we need — the characteristic equation. (2)
Repeated root case: if is a double root, and we only get one solution . Seek (reduction of order). (1) Then , . Substitute: (1) The -coefficient is (root), and (double root ). (1) So ; the new piece is , giving . (1)
(b) Characteristic: . (2) Complex solutions: . Using Euler : (1) Real combinations (sum/difference over 2, 2i) give and . (1)
Question 3
(a) (1) The limit at is only if , so ROC is . (1)
(b) Integrate by parts, : (1) (1) Boundary term: at , (for in ROC); at , . (1)
(c) Transform : . (1) Invert (part a with ): . (1)
Question 4
(a) Transform: . (2) With zero initial conditions:
(b) Partial fractions: . (2) Inverse of this factor: . (1) The triggers the second shift theorem: multiply by and replace : (1) Piecewise:
(c) Since , for :
Question 5
(a) . (2) For : . (1) For : . (1)
(b) Eigenvalues real, opposite signs (, ) ⇒ saddle point, which is unstable. (3)
(c) For , let , , discriminant .
- : saddle (unstable).
- : node (stable if , unstable if ).
- : spiral (stable if , unstable if ); ⇒ centre. (2)
Question 6
(a)
def euler(f, x0, y0, h, n):
xs, ys = [x0], [y0]
x, y = x0, y0
for _ in range(n):
y = y + h * f(x, y)
x = x + h
xs.append(x)
ys.append(y)
return xs, ysMarks: correct update rule (2), loop/n steps (1), returns both lists (1).
(b) , :
- Step 1: .
- Step 2: .
Euler estimate ; exact . Underestimate (error ). (2)
[
{"claim":"Q1b solution y=sin x /x^2 satisfies ODE and IC",
"code":"x=symbols('x'); y=sin(x)/x**2; lhs=diff(y,x)+2/x*y; result=(simplify(lhs-cos(x)/x**2)==0) and (y.subs(x,pi)==0)"},
{"claim":"Q2b roots of char eqn are 2+-3i",
"code":"r=symbols('r'); sols=solve(r**2-4*r+13,r); result=set(sols)==set([2+3*I,2-3*I])"},
{"claim":"Q4 partial fraction 1/(s(s^2+1))=1/s - s/(s^2+1)",
"code":"s=symbols('s'); result=simplify(1/(s*(s**2+1)) - (1/s - s/(s**2+1)))==0"},
{"claim":"Q5 eigenvalues of A are 3 and -1",
"code":"A=Matrix([[1,2],[2,1]]); result=sorted(A.eigenvals().keys())==[-1,3]"},
{"claim":"Q6 two-step Euler for y'=y gives 2.25",
"code":"y=1.0; h=0.5\nfor _ in range(2): y=y+h*y\nresult=abs(y-2.25)<1e-9"}
]