Collection of Foundational Math Problems

Foundational math problems to keep me on track after a long time of not doing math.

2 min readEryawan Presma Yulianrifat

Discrete Mathematics

  1. Derive sample mean update formula. Given μn1=1ni=0n1xi\mu_{n-1}=\frac{1}{n}\sum_{i=0}^{n-1}x_i, derive efficient calculation of μn\mu_{n}.
  2. Derive sample variance update formula. Given σn12=1ni=0n1(xiμn1)2\sigma_{n-1}^2=\frac{1}{n}\sum_{i=0}^{n-1}(x_i-\mu_{n-1})^2, derive efficient calculation of σn2\sigma_{n}^2.

Linear Algebra

  1. Factor for vAvv-Av
  2. Proof that (ab)TD(ab)(a-b)^T D (a-b) is a form of weighted mean squared error with weight on the diagonal matrix D
  3. Define what frobenius norm is, what is the relation with Trace, and what is the derivative of frobenius norm wrt input matrix.

Vector Calculus and Probabilistic Modeling

Interpret w0w_0 correspond to the solution for maximum likelihood estimation given data D={(xi,ti)}i\mathcal D=\{(x_i, t_i)\}_i

t=y(x,w)+ϵt=y(x, w) + \epsilon

Find ww that maximize maximum likelihood given data D={(xi,ti)}i\mathcal D=\{(x_i, t_i)\}_i

t=N(y,σ2)y=w0+w1x0+w2x1++wn+1xn\begin{align*} t &= \mathcal N(y, \sigma^2) \\ y &= w_0 + w_1x_0 + w_2x_1 + \dots + w_{n+1}x_n \end{align*}

Find the closed form of w0w_0 and interpret the function of it.

p(tx,w)=N(t3x+2,1)p(t\mid x, w) = \mathcal N(t\mid 3x+2, 1)

What is the assumed form of the data-generating model tt?

p(y=1x,w)=σ(wTx)=11+exp(wTx)p(y=1\mid x, w) = \sigma(w^Tx)=\frac{1}{1+\exp(-w^Tx)}

What is the full expression for the likelihood p(yx,w)p(y\mid x, w) and naturally lead loss function.

tPoisson(λ(x))λ(x)=exp(w0+w1x)t\sim Poisson(\lambda(x))\quad \lambda(x)=\exp(w_0+w_1x)

Write the expression for p(tx,w)p(t\mid x,w) and best parameter ww using maximum likelihood estimation.

12i(tiwTϕ(xi))2+λ2wTw\frac{1}{2}\sum_i(t_i-w^T\phi(x_i))^2 + \frac{\lambda}{2}w^Tw

Solve for ww that minimize above expression

p(tx,W,σ2)=N(tWTϕ(x),σ2I)=1(2π)Kσ2Iexp(12(tWTϕ(x))T(σI)1(tWTϕ(x)))\begin{align*} p(\vec t\mid x, W, \sigma^2) &= \mathcal N(\vec t\mid W^T\phi(x), \sigma^2 I) \\ &= \frac{1}{\sqrt{(2\pi)^K\vert\sigma^2 I\vert}}\exp\left(-\frac{1}{2}(\vec t - W^T\phi(x))^T(\sigma I)^{-1}(\vec t - W^T\phi(x))\right) \end{align*}

Find the likelihood of above gaussian given D={(xi,ti)}i\mathcal D=\{(x_i, t_i)\}_i then find the best ww that maximize. What optimization we could use to solve for batch dataset (e.g. using the whole dataset instead of using one by one).

Given T=[ti]iRN×K,X=[ϕ(xi)]iRN×D,W=[wiT]iRD×KT=[t_i]_i\in R^{N\times K}, X=[\phi(x_i)]_i\in R^{N\times D}, W=[w^T_i]_i \in R^{D\times K}, find ww that minimize

L(w)=12iNjK(wTϕ(xi)jtij)2\mathcal L(w)= \frac{1}{2}\sum_i^N \sum_j^K (w^T\phi(x_i)_j - t_{ij})^2

Express the above into matrix form utilizing forbenius norm and then solve for ww that minimize above expression.

Given observation state age x0x_0 (old or young) and covid test result x1x_1. Given prior assumption of covid p(y)=0.1p(y)=0.1 and p(x1=1y=1)=0.875p(x_1=1\mid y=1)=0.875 and p(x1=0y=0)=0.975p(x_1=0\mid y=0)=0.975 (no matter the age). Given (x,a)\ell(x, a) as below.

StateDo nothingGive drug
No COVID-19, young08
COVID-19, young608
No COVID-19, old08
COVID-19, old108

For each state, find the optimal action aa^* that minimize the expected loss.

Given (y,a)\ell(y, a) as below. Assume we have a model P(yx)P(y\mid x)

Predicted labela = 0a = 1
True label
y = 000\ell_{00}01\ell_{01}
y = 110\ell_{10}11\ell_{11}

Find the optimal decision rule aa^* that minimize the expected loss using our model PP.

Given (y,a)\ell(y, a) below, find the optimal decision rule aa^* that minimize the expected loss given model P(YX)P(Y\mid X).

l(y,a)={0if a=y^λrif a=rejectλeotherwise\ell l(y, a) = \begin{cases} 0&\text{if }a=\hat y\\ \lambda_r&\text{if }a=\text{reject}\\ \lambda_e&\text{otherwise} \end{cases}

Find closed form solution ww^* that maximize MLE for model below on dataset D={(xi,yi)}i\mathcal D=\{(x_i, y_i)\}_i.

p(y=1x)=11+exp(wTx+b)p(y=1\mid x) = \frac{1}{1+\exp(-w^Tx+b)}

Find closed form solution ww^* that maximize MLE for model below on dataset D={(xi,yi)}i\mathcal D=\{(x_i, y_i)\}_i.

p(y=kx)=S(XWn)p(y=k\mid x) = \mathcal S(XW_n)