Monday, April 28, 2025

Error in Taylor polynomial

Let $f$ be a function, $b<d$, $n\in\mathbb{N}$, $f^{(n)}$ is continuous on $[b,d]$, $f^{(n+1)}$ exists on $(b,d)$. The remainder of its $n$-th degree Taylor polynomial at $a\in [b,d]$ is $$R_n(x):=f(x)-f(a)-(x-a)f'(a)-\frac{(x-a)^2}{2}f''(a)-\dots-\frac{(x-a)^n}{n!}f^{(n)}(a).$$ We prove that for all $a,x\in(b,d)$ $$R_n(x)=\frac{(x-a)^{n+1}}{(n+1)!}f^{(n+1)}(c)$$ for some $c$ between $a$ and $x$.


=========================================


Proof:

By induction on $n$. For $n=0$ this is same as Mean Value Theorem. For $n\in\mathbb{N}$, notice $$R'_n(x)=f'(x)-f'(a)-(x-a)f''(a)-\dots-\frac{(x-a)^{n-1}}{(n-1)!}f^{(n)}(a).$$ Applying inductive hypothesis on $f'$, we get $$R'_n(x)=\frac{(x-a)^n}{n!}f^{(n+1)}\left(c(x)\right)$$ for some $c(x)$ between $a$ and $x$. So $$R_n(x)=R_n(a)+\int_a^x\frac{(t-a)^{n}}{n!}f^{(n+1)}\left(c(t)\right)dt$$ where $R_n(a)=0$. By Weighted Mean Value Theorem, which requires that $f^{(n+1)}\left(c(t)\right)$ is continuous and $(t-a)^n/n!$ does not change sign between $a$ and $x$, we have $$R_n(x)=f^{(n+1)}(c)\int_a^x\frac{(t-a)^{n}}{n!}dt=\frac{(x-a)^{n+1}}{(n+1)!}f^{(n+1)}(c)$$ for some $c$ between $a$ and $x$.

Caveat: we used the fact without proof that $c(x)$ is continuous over $[b,d]$ for $R'_n(x)$.

Thursday, April 24, 2025

Central limit theorem

Let $T$ be a zero-mean unit-variance random variable with probability density function $f(t)$. If its variance is not $1$ then divide $T$ by its standard deviation. We show that $$\lim_{n\rightarrow\infty}\frac{1}{\sqrt{n}}\left(T_1+\dots+T_n\right)$$ approaches standard normal random variable, where $T_1,\dots,T_n$ are independent samples from $T$.


==================

Proof:

Denote by $F(\mu)$ the Fourier transform of $f(t)$, written as $$f(t)\leftrightarrow F(\mu).$$ $f(t)$ is a probability density function implies that $F(0)=1$. Given $$tf(t)\leftrightarrow \frac{jF'(\mu)}{2\pi}$$ and $$\int_{-\infty}^\infty tf(t)dt=0$$ we have $F'(0)=0$. Since $$\int_{-\infty}^\infty t^2f(t)dt=1$$ and $$t^2f(t)\leftrightarrow-\frac{1}{4\pi^2}F''(\mu),$$ we get $F''(0)=-4\pi^2$. Hence we write $$F(\mu)=F(0)+\mu F'(0)+\frac{\mu^2}{2}F''(0)+\dots=1-2\pi^2\mu^2+\frac{F'''(0)}{6}\mu^3+\cdots.$$Adding $n$ independent samples of $T$ translates to convolution of $n$ copies of $f(t)$, which translates to $F(\mu)^n$. Division by $\sqrt{n}$ translates to replacing $\mu$ with $\mu/\sqrt{n}$. Thus the Fourier transform of the probability density function of interest is $$F\left(\frac{\mu}{\sqrt{n}}\right)^n=\left(1-\frac{2\pi^2\mu^2}{n}+\frac{F'''(0)}{6n^{1.5}}\mu^3+\cdots\right)^n\approx e^{-2\pi^2\mu^2},$$which is the Fourier transform of $$\frac{1}{\sqrt{2\pi}}e^{-\frac{t^2}{2}}.$$

Central limit theorem for discrete random variable

 Suppose that $X'$ is a random variable with $\Pr(X'=1)=\Pr(X'=-1)=0.5$. Then $$X=\lim_{n\rightarrow\infty}\frac{1}{\sqrt{n}}(X_1+X_2+\dots+X_n)$$ approaches normal random variable with zero mean and unity variance, where $X_i$s are independent samples of $X'$.

Below we prove that $$\Pr(X=x)\approx e^{-\frac{x^2}{2}}\Pr(X=0).$$


==================

Proof:

We consider $2n$ samples instead. $X=x$ translates to $n+k$ samples of $1$ and $n-k$ samples of $-1$ among $X_1,\dots,X_n$ where $$k=\frac{x\sqrt{2n}}{2}.$$ For any $k\in\mathbb{N}$ we have $$\frac{\Pr(X=x)}{\Pr(X=0)}=\frac{\binom{2n}{n+k}}{\binom{2n}{2n}}=\frac{n!n!}{(n+k)!(n-k)!}=\frac{n(n-1)\dots(n-k+1)}{(n+k)(n+k-1)\dots(n+1)}\approx(1-\frac{k}{n})^k.$$ Substituting $x\sqrt{2n}/2$ for $k$ we get $$\frac{\Pr(X=x)}{\Pr(X=0)}\approx\left(1-\frac{x}{\sqrt{2n}}\right)^{\frac{\sqrt{2nx}}{2}}\approx e^{-\frac{x^2}{2}}.$$ 

Monday, April 14, 2025

Hopefully the last geometry puzzle for now

 $ABCD$ is a square with $AB=1$. $F$ lies on segment $CD$ and segment $BF$ intersects with segment $AC$ at point $E$ such that $EF=DF$. What is the length of $BE$?


======================================


Solution:

Let $G$ be a point on segment $CD$ such that $EG$ is orthogonal to $CD$. Let $H$ be a point on segment $AD$ such that $EH$ is orthogonal to $EG$. We see that $\angle HED=\angle DEF=\angle FEG$, so they are all $30^\circ$.

Extend $D$ to $I$ away from $C$ on line $CD$ such that $ID=BE$. We have $\angle BIC=30^\circ$, so $BE=ID=IC-DC=\sqrt{3}-1$.

Sunday, April 13, 2025

Yet another geometry puzzle

 In triangle $ABC$, $\angle B=60^\circ$ and $\angle C=40^\circ$. Extend $A$ away from $C$ to $D$ such that $AD=BC$. What is $\angle ADB$?

============================================


Solution:

Let point $E$ lie on segment $BC$ such that $AEB$ is an equilateral triangle. Let point $F$ lie on segment $AD$ such that $AF=AB$. Since SAS condition holds, $FBE$ is congruent to $DAB$, and $\angle ADB=30^\circ$ follows almost immediately.

Another geometry puzzle

 $ABC$ is a isosceles triangle with $AC=BC$ and $\angle C=20^\circ$. Point $D$ lies inside segment $BC$ such that $DC=AB$. What is $\angle ADB$?


========================================

Solution:

Let point $E$ lie on the same side of segment $AC$ as $B$ such that $AEC$ is a equilateral triangle. Due to SAS condition, $ABE$ is congruent to $CDA$. It then follows almost immediately that $\angle ADB=30^\circ$.

Monday, April 7, 2025

A geometry puzzle

 $ABC$ is a triangle where $\angle BAC=100^\circ$. Also $BA=AC$. Extend $C$ away from $A$ to $D$ such that $AD=BC$. What is $\angle BDA$?


This got me :(


=======================


Let $BEA$ be an equilateral triangle such that $E,C,D$ lie on the same side of line $AB$. So $\angle EAC=40^\circ$, and triangle $ABC$ is congruent to triangle $EAD$ because SAS condition holds. Now $\angle BDA=30^\circ$ follows almost immediately.

Sunday, April 6, 2025

Curve of fastest descent

In 1696, Johann Bernoulli proposed the problem of finding the curve of fastest descent: given a point $A$ and a lower point $B$ which is not directly below $A$, find the curve lying on the plane between the two points on which a bead slides frictionlessly under the influence of a uniform gravitational field in the shortest time. It was then famously solved by Issac Newton in 1697. See this wiki page.

The curve is called Brachistochrone curve, which is a cycloid. 

I give my solution below.

=========================================

Let the curve we are seeking be $L$. We flip it upside-down s.t. the bead has velocity $\sqrt{2gy}$ at height $y$. Divide $L$ into $n$ very small segments of vertical height $\Delta y$, horizontal lengths $\Delta x_1,\Delta x_2,\dots,\Delta x_n$, and heights $y_1,y_2,\dots,y_n$. Then the following is minimized 

$$\sum_{i=1}^n\frac{\sqrt{\Delta y_i^2+\Delta x_i^2}}{\sqrt{y_i}}$$

such that $\sum_{i=1}^n\Delta x_i$ is the horizontal difference of $A$ and $B$. Langrange multiplier implies that

$$y\left(1+\left(\frac{dy}{dx}\right)^2\right)=2R$$

throughout $L$ for some positive constant $R$.

Let $\phi$ be the angle between the tangent line of $P(x,y)$ on $L$ and the $x$-axis. Then

$$\frac{y}{\cos^2\phi}=2R$$ throughout $L$, or

$$y=R\left(1+\cos2\phi\right).$$

We have $\frac{dy}{d\phi}=-2R\sin2\phi$, so let $\frac{dx}{d\phi}=-2R\frac{\sin2\phi}{\tan\phi}=2R(1+\cos2\phi)$. Then

$$x=2R\left(\phi+\frac{1}{2}\sin2\phi\right)+C.$$

Define $\theta:=2\phi-\pi$, we have

$$x=R\left(\theta-\sin\theta\right)+C,$$

$$y=R\left(1-\cos\theta\right).$$

So $L$ is a cycloid. Note that for $y=0$ we have $\phi=\pi/2$ and $\theta=0$. This makes sense, because no horizontal movement should be allocated to the minimum velocity.

How to solve $R$ and $\theta_0$ where $A=(0,0)$ and $B=\left(R\left(\theta_0-\sin\theta_0\right), R\left(1-\cos\theta_0\right)\right)$? Note that the mapping

$$f(\theta)=\frac{\theta-\sin\theta}{1-\cos\theta}$$

is bijective for $\theta\in(0,2\pi)$, so $\theta_0$ can be uniquely determined by the ratio of two coordinates of $B$, after which $R$ can be determined as well.