= Paper 2
{scope}

https://www.maths.cam.ac.uk/undergrad/pastpapers/files/2021/paperia_2_2021.pdf

= 1A
{parent=Paper 2}
{scope}
{title2=Differential Equations}

= Solution
{parent=1A}

The homogeneous <linear recurrence relation>
$$
y_{n+2}-4y_{n+1}+4y_n=0
$$
has characteristic polynomial $(r-2)^2$, so
$$
y_n^{(h)}=(C+Dn)2^n.
$$
For a particular solution, substitute $y_n=an+b$. The left-hand side becomes
$$
an+(b-2a),
$$
so matching $n$ gives $a=1$ and $b=2$. Hence
$$
y_n=(C+Dn)2^n+n+2.
$$
The conditions $y_0=1$ and $y_1=0$ give $C=-1$ and $D=-1/2$. Therefore
$$
\boxed{y_n=n+2-\left(1+\frac n2\right)2^n}.
$$

Solved by gpt-5.6-sol high.

= 2A
{parent=Paper 2}
{scope}
{title2=Differential Equations}

= Solution
{parent=2A}

Differentiating the <Wronskian> gives
$$
\begin{aligned}
W'
&=(y_1y_2'-y_2y_1')'\\
&=y_1y_2''-y_2y_1''\\
&=y_1(-py_2'-qy_2)-y_2(-py_1'-qy_1)\\
&=-pW.
\end{aligned}
$$
Thus $W'+pW=0$, the <Abel identity>.

Also,
$$
\left(\frac{y_2}{y_1}\right)'
=\frac{y_1y_2'-y_2y_1'}{y_1^2}
=\frac W{y_1^2}.
$$
If $y_2(x_0)=0$, integration gives the <reduction of order> formula
$$
\boxed{
y_2(x)=y_1(x)\int_{x_0}^x\frac{W(t)}{y_1(t)^2}\,dt}.
$$

For the specified equation, division by $x^2$ gives $p(x)=-1/x$, so $W=Cx$. With $y_1=x^3$, an independent solution is
$$
x^3\int x^{-5}\,dx,
$$
which is a nonzero multiple of $x^{-1}$. Hence
$$
y=Ax^3+\frac Bx.
$$
The conditions at $x=1$ give $A+B=0$ and $3A-B=1$, so
$$
\boxed{y(x)=\frac14\left(x^3-\frac1x\right)}.
$$

Solved by gpt-5.6-sol high.

= 3D
{parent=Paper 2}
{scope}
{title2=Probability}

= Solution
{parent=3D}

After $n$ tosses, the next total is even if either the current total is even and a tail occurs, or the current total is odd and a head occurs. Therefore
$$
q_{n+1}=(1-p)q_n+p(1-q_n)
=p+(1-2p)q_n.
$$
Since $q_0=1$, subtracting the fixed point $1/2$ gives
$$
q_{n+1}-\frac12
=(1-2p)\left(q_n-\frac12\right).
$$
Thus
$$
\boxed{
q_n=\frac{1+(1-2p)^n}{2}}.
$$
The formula also covers the endpoint cases $p=0$ and $p=1$.

Solved by gpt-5.6-sol high.

= 4F
{parent=Paper 2}
{scope}
{title2=Probability}

= Solution
{parent=4F}

Normalization of the <probability density function> gives
$$
1=c\int_0^{\sqrt3}\frac{dx}{1+x^2}
=c\arctan(\sqrt3)
=c\frac\pi3,
$$
so
$$
\boxed{c=\frac3\pi}.
$$
The <expected value> is
$$
\mathbb EX
=\frac3\pi\int_0^{\sqrt3}\frac{x}{1+x^2}\,dx
=\boxed{\frac{3\log2}{\pi}}.
$$
The second moment is
$$
\mathbb EX^2
=\frac3\pi\int_0^{\sqrt3}\frac{x^2}{1+x^2}\,dx
=\frac{3\sqrt3}{\pi}-1.
$$
Therefore the <variance> is
$$
\boxed{
\operatorname{var}X
=\frac{3\sqrt3}{\pi}-1
-\frac{9(\log2)^2}{\pi^2}}.
$$

For the <median> $m$,
$$
\frac3\pi\arctan m=\frac12,
$$
so
$$
\boxed{m=\tan\frac\pi6=\frac1{\sqrt3}}.
$$

Solved by gpt-5.6-sol high.

= 5A
{parent=Paper 2}
{scope}
{title2=Differential Equations}

= Solution
{parent=5A}

For
$$
y''+P(x)y'+Q(x)y=0,
$$
$x_0$ is an ordinary point when $P$ and $Q$ are analytic there, and a singular point otherwise. A singular point is regular singular when $(x-x_0)P(x)$ and $(x-x_0)^2Q(x)$ are analytic there. These are the ordinary-point and <regular singular point criterion for a second-order equation>[regular-singular] criteria.

For <Kummer differential equation>[Kummer's equation], substitute
$$
y=\sum_{m=0}^{\infty}c_mx^m.
$$
Equating the coefficient of $x^m$ gives
$$
(m+1)(m+b)c_{m+1}=(m+a)c_m.
$$
Taking $c_0=1$,
$$
\boxed{
c_m(a,b)=\frac{(a)_m}{(b)_m\,m!}},
$$
where $(a)_m=a(a+1)\cdots(a+m-1)$ is the rising factorial. Thus
$$
y_1=M(x,a,b)
=\sum_{m=0}^{\infty}\frac{(a)_m}{(b)_m\,m!}x^m.
$$

Putting $y=x^{1-b}u$ and simplifying gives
$$
xu''+(2-b-x)u'-(a-b+1)u=0.
$$
Therefore
$$
\boxed{
y_2=x^{1-b}M(x,a-b+1,2-b)}.
$$
For nonintegral $b$, the powers $x^0$ and $x^{1-b}$ at zero are distinct, so these solutions are linearly independent.

When $b\to1$, both solutions tend to $M(x,a,1)$. Differentiate their difference with respect to $b$. Writing $M_a,M_b$ for derivatives with respect to the second and third arguments,
$$
\begin{aligned}
\lim_{b\to1}\frac{y_2-y_1}{b-1}
&=-M(x,a,1)\log x\\
&\quad-M_a(x,a,1)-2M_b(x,a,1).
\end{aligned}
$$
Hence at $b=1$ one may take
$$
\boxed{
M(x,a,1),\qquad
-M(x,a,1)\log x-M_a(x,a,1)-2M_b(x,a,1)}
$$
as two linearly independent solutions. Their independence follows from the logarithmic term in the second solution.

Solved by gpt-5.6-sol high.

= 6A
{parent=Paper 2}
{scope}
{title2=Differential Equations}

= Solution
{parent=6A}

With $\eta=x-t$ and $\xi=x+t$, the <chain rule> gives
$$
\partial_x=\partial_\eta+\partial_\xi,
\qquad
\partial_t=-\partial_\eta+\partial_\xi.
$$
Hence
$$
u_{xx}-u_{tt}=4U_{\eta\xi},
$$
so the <wave equation> is equivalent to $U_{\eta\xi}=0$. Integrating in each variable gives
$$
u(x,t)=F(x-t)+G(x+t).
$$
The initial conditions imply
$$
F(x)+G(x)=f(x),
\qquad
-F'(x)+G'(x)=g(x).
$$
Solving and integrating yields the <D'Alembert formula with initial velocity>
$$
\boxed{
u(x,t)=\frac12[f(x-t)+f(x+t)]
+\frac12\int_{x-t}^{x+t}g(y)\,dy}.
$$

If $|x-x_0|>r+t$, then both $x-t$ and $x+t$ lie outside the support interval $[x_0-r,x_0+r]$, and every point between them does as well. All three terms therefore vanish. Thus
$$
\boxed{u(x,t)=0\quad\text{when }|x-x_0|>r+t},
$$
which is finite propagation speed.

For the finite string, differentiate its energy and use $y_{tt}=y_{xx}$:
$$
\begin{aligned}
\frac{dE}{dt}
&=\int_0^L(y_xy_{xt}+y_ty_{tt})\,dx\\
&=\int_0^L(y_xy_{xt}+y_ty_{xx})\,dx\\
&=[y_ty_x]_0^L.
\end{aligned}
$$
The fixed-end conditions hold for every $t$, so differentiation gives $y_t(0,t)=y_t(L,t)=0$. The boundary term vanishes and
$$
\boxed{E(t)=E(0)}.
$$

Solved by gpt-5.6-sol high.

= 7A
{parent=Paper 2}
{scope}
{title2=Differential Equations}

= Solution
{parent=7A}

Put $\omega=\dot\theta$. The first-order system is
$$
\boxed{
\dot\theta=\omega,\qquad
\dot\omega=-\sin\theta
\left(\lambda-2\mu+\frac{2\mu}{\sqrt{5+4\cos\theta}}\right)}.
$$
Write
$$
h(\theta)=\lambda-2\mu
+\frac{2\mu}{\sqrt{5+4\cos\theta}}.
$$
On $[0,\pi]$, $h$ is strictly increasing. Moreover,
$$
h(0)=\lambda-\frac{4\mu}{3}<0,
\qquad
h(\pi)=\lambda>0
$$
when $3\lambda<4\mu$. Thus there is one $\theta_*\in(0,\pi)$ with $h(\theta_*)=0$, in addition to the fixed points at $\theta=0,\pi$. Explicitly,
$$
\boxed{
\cos\theta_*
=\frac{\mu^2}{(2\mu-\lambda)^2}-\frac54}.
$$

Let $g(\theta)=\sin\theta\,h(\theta)$. Linearization at $(\theta_0,0)$ has eigenvalues satisfying
$$
\sigma^2=-g'(\theta_0).
$$
At zero, $g'(0)=h(0)<0$, and at $\pi$, $g'(\pi)=-h(\pi)<0$, so both endpoints are saddles. At the interior point,
$$
g'(\theta_*)=\sin\theta_*h'(\theta_*)>0,
$$
so $(\theta_*,0)$ is a center. On the full angular interval there is a second center at $(-\theta_*,0)$.

The system has the conserved energy of a <conservative planar phase portrait>,
$$
\boxed{
E=\frac{\omega^2}{2}
-(\lambda-2\mu)\cos\theta
-\mu\sqrt{5+4\cos\theta}}.
$$
For $\lambda=1$, $\mu=3/2$,
$$
\cos\theta_*=-\frac{11}{16}.
$$
The phase portrait on the cylinder consists of centers at $\theta=\pm\arccos(-11/16)$ surrounded by closed periodic-energy curves, with saddles at $\theta=0$ and the identified point $\theta=\pi=-\pi$. The saddle-energy contours form the separatrices between librations in the potential wells and trajectories crossing the lower barrier.

If $3\lambda>4\mu$, then $h(0)>0$ and monotonicity gives no interior zero on $(0,\pi)$. The point $(0,0)$ becomes a center, while $(\pi,0)$ remains a saddle. At $3\lambda=4\mu$, the two off-axis centers coalesce with the origin and the linearization there is degenerate.

Solved by gpt-5.6-sol high.

= 8A
{parent=Paper 2}
{scope}
{title2=Differential Equations}

= Solution
{parent=8A}

Termwise differentiation of the <matrix exponential> gives
$$
\begin{aligned}
\frac d{dt}e^{tA}
&=\sum_{m=1}^{\infty}\frac{m t^{m-1}A^m}{m!}\\
&=A\sum_{j=0}^{\infty}\frac{t^jA^j}{j!}
=Ae^{tA}.
\end{aligned}
$$
Thus $y(t)=e^{tA}y_0$ satisfies $y'=Ay$ and $y(0)=y_0$. If two solutions existed, multiplying their difference by $e^{-tA}$ would give a vector with zero derivative and zero initial value, proving uniqueness.

For the inhomogeneous equation, multiply by the integrating factor $e^{-tA}$:
$$
\frac d{dt}(e^{-tA}x)=e^{-tA}f(t).
$$
Integration and multiplication by $e^{tA}$ give the variation-of-constants formula
$$
\boxed{
x(t)=e^{tA}x_0
+\int_0^te^{(t-s)A}f(s)\,ds}.
$$

For the stated matrix,
$$
A^2=
\begin{pmatrix}
12&-4&-4\\
12&-4&-4\\
24&-8&-8
\end{pmatrix},
\qquad
A^3=0,
$$
so
$$
e^{tA}=I+tA+\frac{t^2}{2}A^2.
$$
Writing $f(t)=v\sin t$ with $v=(1,3,0)^T$, one finds
$$
Ax_0=0,\qquad Av=(8,8,16)^T,\qquad A^2v=0.
$$
Therefore
$$
x(t)=x_0+v(1-\cos t)+Av(t-\sin t),
$$
or explicitly
$$
\boxed{
x(t)=
\begin{pmatrix}
8t-8\sin t-\cos t+2\\
8t-8\sin t-3\cos t+4\\
16t-16\sin t+2
\end{pmatrix}}.
$$

Solved by gpt-5.6-sol high.

= 9E
{parent=Paper 2}
{scope}
{title2=Probability}

= a
{parent=9e}
{scope}

= i
{parent=a}
{scope}

= Solution
{parent=i}

For $\mathbb P(B)>0$, the <conditional probability> is
$$
\mathbb P(A\mid B)
=\frac{\mathbb P(A\cap B)}{\mathbb P(B)}.
$$
Hence
$$
\mathbb P(B_j\mid A)
=\frac{\mathbb P(A\mid B_j)\mathbb P(B_j)}
{\mathbb P(A)}.
$$
Because the $B_k$ form a partition, the law of total probability gives
$$
\mathbb P(A)
=\sum_{k=1}^n\mathbb P(A\mid B_k)\mathbb P(B_k).
$$
Substitution proves <Bayes theorem> in the required form:
$$
\boxed{
\mathbb P(B_j\mid A)
=\frac{\mathbb P(A\mid B_j)\mathbb P(B_j)}
{\sum_{k=1}^n\mathbb P(A\mid B_k)\mathbb P(B_k)}}.
$$

Solved by gpt-5.6-sol high.

= ii
{parent=a}
{scope}

= Solution
{parent=ii}

Urn $r$ has $n-r$ blue balls among $n-1$ balls. Averaging over the uniformly chosen urn,
$$
\mathbb P(\text{first blue})
=\frac1n\sum_{r=1}^n\frac{n-r}{n-1}
=\boxed{\frac12}.
$$
The probability that both removed balls are blue is
$$
\begin{aligned}
\mathbb P(B_1\cap B_2)
&=\frac1n\sum_{r=1}^n
\frac{(n-r)(n-r-1)}{(n-1)(n-2)}\\
&=\frac13.
\end{aligned}
$$
Therefore
$$
\boxed{
\mathbb P(B_2\mid B_1)
=\frac{\mathbb P(B_1\cap B_2)}{\mathbb P(B_1)}
=\frac23}.
$$
The first blue draw makes urns with more blue balls more likely, which explains why the conditional probability exceeds one half.

Solved by gpt-5.6-sol high.

= b
{parent=9e}
{scope}

= i
{parent=b}
{scope}

= Solution
{parent=i}

Events $A$ and $B$ are <independent events>[independent] when
$$
\mathbb P(A\cap B)=\mathbb P(A)\mathbb P(B).
$$
For a possible sum $2\leq t\leq12$, let $N_t$ be the number of ordered die pairs with sum $t$. Then
$$
\mathbb P(A_t)=\frac{N_t}{36},
\qquad
\mathbb P(B_i)=\frac16.
$$
If $t-i\in\{1,\ldots,6\}$, then $\mathbb P(A_t\cap B_i)=1/36$; otherwise it is zero. Independence for a possible sum therefore requires
$$
\frac1{36}=\frac{N_t}{216},
$$
so $N_t=6$. This occurs only for $t=7$, and then $7-i$ is valid for every $i=1,\ldots,6$. Thus
$$
\boxed{A_t\text{ and }B_i\text{ are independent exactly when }
t=7,\ 1\leq i\leq6}.
$$
If impossible sums are admitted as events of probability zero, they are trivially independent as well.

Solved by gpt-5.6-sol high.

= ii
{parent=b}
{scope}

= Solution
{parent=ii}

Call the coins $1,2,3$ in the order given. Coin 1 beats the constant score of coin 2 exactly when it shows a head, so coin 1 wins with probability $3/5$. Coin 2 beats coin 3 exactly when coin 3 shows a head and scores three, again with probability $3/5$.

Coin 3 beats coin 1 whenever coin 3 shows a tail, or when coin 3 shows a head and coin 1 shows a tail. Its winning probability is therefore
$$
\frac25+\frac35\frac25
=\frac{16}{25}>\frac12.
$$
Thus the preferences form a nontransitive cycle:
$$
1\text{ beats }2,\qquad
2\text{ beats }3,\qquad
3\text{ beats }1.
$$
The second chooser can always select a coin that has winning probability greater than one half against the first choice. Therefore
$$
\boxed{\text{it is preferable to choose second}.}
$$

Solved by gpt-5.6-sol high.

= 10E
{parent=Paper 2}
{scope}
{title2=Probability}

= a
{parent=10e}
{scope}

= Solution
{parent=a}

Ignore rolls showing $2,3,4,5$ and consider the first roll among $\{1,6\}$. By symmetry, the event $A$ that a 1 occurs before a 6 has probability $1/2$. The event that the very first roll is 1 has probability $1/6$ and is contained in $A$. Hence
$$
\boxed{
\mathbb P(\text{first roll is }1\mid A)
=\frac{1/6}{1/2}=\frac13}.
$$

Solved by gpt-5.6-sol high.

= b
{parent=10e}
{scope}

= i
{parent=b}
{scope}

= Solution
{parent=i}

Let $h(x)$ be the probability that the <simple random walk on the integer line>[simple symmetric random walk] starting at $x\in\{0,\ldots,n\}$ hits zero before $n$. The first-step recurrence is
$$
h(x)=\frac12h(x-1)+\frac12h(x+1),
\qquad
h(0)=1,\quad h(n)=0.
$$
The recurrence says that $h$ is affine, and the boundary values determine it:
$$
\boxed{h(x)=\frac{n-x}{n}}.
$$

Solved by gpt-5.6-sol high.

= ii
{parent=b}
{scope}

= Solution
{parent=ii}

Part (i) gives $\mathbb P(A)=2/3$. Since $\{X_1=0\}\subseteq A$ and has probability $1/2$,
$$
\boxed{\mathbb P(X_1=0\mid A)=\frac{1/2}{2/3}=\frac34}.
$$
Conditioned on $A$, a walk at one moves to zero with probability $3/4$ and to two with probability $1/4$. A walk at two must next move to one, since a move to three would violate $A$. If
$$
e_i=\mathbb E_i(T\mid A),
$$
first-step analysis gives
$$
e_1=1+\frac14e_2,
\qquad
e_2=1+e_1.
$$
Solving,
$$
\boxed{\mathbb E(T\mid A)=e_1=\frac53}.
$$

Solved by gpt-5.6-sol high.

= iii
{parent=b}
{scope}

= Solution
{parent=iii}

For hitting zero before four, the success probabilities are
$$
h_i=\frac{4-i}{4}.
$$
Conditioning each transition on eventual success gives
$$
\begin{array}{c|cc}
\text{state}&\text{down}&\text{up}\\ \hline
1&2/3&1/3\\
2&3/4&1/4\\
3&1&0.
\end{array}
$$
Thus the conditional expected hitting times satisfy
$$
e_1=1+\frac13e_2,
\qquad
e_2=1+\frac34e_1+\frac14e_3,
\qquad
e_3=1+e_2.
$$
Solving this linear system gives
$$
\boxed{\mathbb E(T\mid B)=e_1=\frac73}.
$$

Solved by gpt-5.6-sol high.

= 11D
{parent=Paper 2}
{scope}
{title2=Probability}

= Solution
{parent=11D}

Uniform area density in the unit disk is $1/\pi$. The <polar coordinates> Jacobian gives the joint density
$$
f_{R,\Theta}(r,\theta)
=\frac r\pi
=\left(2r\right)\left(\frac1{2\pi}\right),
\qquad
0\leq r\leq1,\quad0\leq\theta<2\pi.
$$
Thus the coordinates are independent and the <uniform random point in a disk> has
$$
\boxed{
f_R(r)=2r\mathbf1_{[0,1]}(r),
\qquad
f_\Theta(\theta)=\frac1{2\pi}\mathbf1_{[0,2\pi)}(\theta)}.
$$

For independent points $A,B$, the area of triangle $OAB$ is
$$
\frac12R_AR_B|\sin(\Theta_A-\Theta_B)|.
$$
Now
$$
\mathbb ER=\int_0^1 2r^2\,dr=\frac23,
\qquad
\mathbb E|\sin(\Theta_A-\Theta_B)|=\frac2\pi.
$$
Independence therefore gives
$$
\boxed{\mathbb E\,\operatorname{Area}(OAB)=\frac4{9\pi}}.
$$
Conditioned on $A,B$, the probability that $C$ lies inside $OAB$ is its area divided by the disk area $\pi$. Hence
$$
\boxed{\mathbb P(C\in\triangle OAB)=\frac4{9\pi^2}}.
$$

Four points in general position fail to form a convex quadrilateral exactly when one lies inside the triangle formed by the other three. Each of $A,B,C$ lies inside the triangle formed by $O$ and the other two with probability $4/(9\pi^2)$, and these three events are disjoint. The remaining possibility is that $O$ lies inside $ABC$. By <origin in a triangle of three radial random points>, this has probability $1/4$. Therefore
$$
\boxed{
\mathbb P(O,A,B,C\text{ form a convex quadrilateral})
=1-\frac14-\frac{4}{3\pi^2}
=\frac34-\frac4{3\pi^2}}.
$$

Solved by gpt-5.6-sol high.

= 12F
{parent=Paper 2}
{scope}
{title2=Probability}

= i
{parent=12f}
{scope}

= Solution
{parent=i}

The <Chebyshev inequality> states that for a random variable $Y$ with finite variance and every $\delta>0$,
$$
\mathbb P(|Y-\mathbb EY|\geq\delta)
\leq\frac{\operatorname{var}Y}{\delta^2}.
$$
Indeed, <Markov inequality> applied to the nonnegative variable $(Y-\mathbb EY)^2$ gives
$$
\mathbb P((Y-\mathbb EY)^2\geq\delta^2)
\leq\frac{\mathbb E[(Y-\mathbb EY)^2]}{\delta^2}.
$$

The sum $S_n=X_1+\cdots+X_n$ has the <binomial distribution>, so
$$
\boxed{
B_n(p)=
\sum_{k=0}^n f(k/n)\binom nkp^k(1-p)^{n-k}}.
$$
For fixed $n$ this is a finite sum of polynomial functions of $p$, hence is a polynomial.

Solved by gpt-5.6-sol high.

= ii
{parent=12f}
{scope}

= Solution
{parent=ii}

The sample mean $S_n/n$ has expectation $p$ and variance
$$
\frac{p(1-p)}n\leq\frac1{4n}.
$$
The sum in the question is exactly
$$
\mathbb P\left(\left|\frac{S_n}{n}-p\right|>\delta\right).
$$
Chebyshev's inequality therefore gives, uniformly in $p$,
$$
\boxed{
\sum_{k\in K_\delta}\binom nkp^k(1-p)^{n-k}
\leq\frac1{4n\delta^2}}.
$$

Solved by gpt-5.6-sol high.

= iii
{parent=12f}
{scope}

= Solution
{parent=iii}

Because $f$ is continuous on the compact interval $[0,1]$, it is uniformly continuous and bounded; write $|f|\leq M$. Given $\epsilon>0$, choose $\delta>0$ such that
$$
|x-y|\leq\delta
\quad\Longrightarrow\quad
|f(x)-f(y)|\leq\epsilon.
$$
Then
$$
\begin{aligned}
|B_n(p)-f(p)|
&\leq
\mathbb E\left|f(S_n/n)-f(p)\right|\\
&\leq
\epsilon
+2M\mathbb P\left(\left|S_n/n-p\right|>\delta\right)\\
&\leq
\epsilon+\frac{M}{2n\delta^2}.
\end{aligned}
$$
The bound is independent of $p$. Taking the supremum, then $n\to\infty$, gives a limit superior at most $\epsilon$. Since $\epsilon$ is arbitrary,
$$
\boxed{
\sup_{p\in[0,1]}|f(p)-B_n(p)|\longrightarrow0}.
$$
This is the <Bernstein polynomial> proof of the <Weierstrass approximation theorem>.

Solved by gpt-5.6-sol high.
