Skip to content

Instantly share code, notes, and snippets.

@zaz
Last active December 16, 2021 04:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zaz/3d9e6efef54459a4f0c8c6da16484faf to your computer and use it in GitHub Desktop.
Save zaz/3d9e6efef54459a4f0c8c6da16484faf to your computer and use it in GitHub Desktop.
\documentclass[a4paper]{article}
\usepackage{multicol, amsmath, amsfonts, xcolor}
\usepackage[landscape, margin=0.2in]{geometry}
\title{15.415 Cheat Sheet}
\author{Zaz Brown}
\date{Dec 2021}
\newcommand{\dd}{\mathrm d}
\newcommand{\ddd}[2]{\frac{\dd^2 #1}{\dd #2^2}}
\newcommand{\pd}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\topd}[1]{ \stackrel{\partial {#1}}\longrightarrow }
\newcommand{\pdd}[2]{\frac{\partial^2 #1}{\partial #2^2}}
\newcommand{\sep}{ \textbf{;} \ }
\newcommand{\var}{ \mathrm{Var} }
\newcommand{\cov}{ \mathrm{Cov} }
\newcommand{\PV}{ \mathrm{PV} } % present value
\newcommand{\CF}{ \mathrm{CF} } % cash flow
\newcommand{\io}{{ \boldsymbol\iota }}
\newcommand{\w}{{ \mathbf w }}
\newcommand{\pmat}[1]{ \begin{pmatrix} #1 \end{pmatrix} }
\setlength{\parindent}{0pt}
\begin{document}
\begin{multicols*}{3}
\textbf{2021-12-15 15.415 Foundations of Modern Finance, Zaz Brown} \\
\\
Yield-to-maturity of a bond, y:
$$
B = \sum_{t=1}^T \frac{C_t}{(1+y)^t} + \frac{P}{(1+y)^T}
$$
Where $B$ is bond price.
\\
Macaulay duration is the weighted average term to maturity:
$$
D = \sum_{t=1}^T \frac{\PV(\CF_t)}{B} t = \frac 1 B \sum_{t=1}^T \frac{\CF_t}{(1+y)^t} t
$$
Modified duration:
$$
MD = \frac{D}{1+y}
$$
Convexity of bond measures the curvature of the bond price as a function of yield:
$$
CX = \frac{1}{2 B} \ddd{B}{y}
$$
\textbf{OTHER, GENERAL INFO:} \\
\\
\textbf{Linear Algebra} \\
\begin{align*}
\begin{bmatrix}
a & b \\
c & d
\end{bmatrix}^{-1}
= \frac{1}{ad-bc} \begin{bmatrix}
d & -b \\
-c & a
\end{bmatrix}, \ \
\det = ad-bc, \\
\lambda = \frac 1 2 \left(a + d \pm \sqrt{a^2 + d^2 + 4 b c - 2 a d}\right)
\end{align*}
\textbf{Eigenvalues} $(A-\lambda I)\mathbf v = \mathbf 0 \iff \mid A-\lambda I \mid = 0$ \\
$\det(A) = \prod \boldsymbol\lambda, \ \ \mathrm{tr}(A) = \sum \boldsymbol\lambda$ \\
If all upper-left determinants $> 0$, all $\lambda > 0$ \\
\textbf{Lagrange: Maximize $f$ while $g = c$:} \\
\indent \ \ \ \ \textbf{3. Identify critical poits by solving:}
\small $$\nabla(f(\mathbf v) - \lambda(g(\mathbf v)-c)) = 0$$
\scriptsize
\indent \ \ \ \ \ \ \ \ \textit{\textbf{Alternatively, when $\mathbf v=[x,y]$, solve:}}
\small $$\pd f x \Big/ \pd g x = \pd f y \Big/ \pd g y, \ g=c$$ \\
\scriptsize
\indent \ \ \ \ \textbf{2. Determine if max or min using eigenvalues of} $\mathbf H(\mathbf v)
{\color{gray}\ \sim \nabla^2(\mathbf v)}$ \\
\indent \ \ \ \ \ \ \ \ \textit{\textbf{Hack: compare with nearby points}} \\
\indent \ \ \ \ \ \ \ \ All positive $\implies$ local minimum \\
\indent \ \ \ \ \ \ \ \ All negative $\implies$ local maximum \\
\indent \ \ \ \ \ \ \ \ Some zero $\implies$ flat directions \\
\indent \ \ \ \ \ \ \ \ Mixed +/- $\implies$ saddle point \\
\indent \ \ \ \ \textbf{1. Check endpoints.} \\
\\
\textbf{Series:}
$$
\sum_{k=0}^n r^n = \frac{1-r^{n+1}}{1-r}, \ \
\sum_{n=1}^\infty \frac{(-1)^{n+1}}{n} = \ln(2), \ \
\sum_{n=1}^\infty \frac{1}{n^p} = \infty \iff p \leq 1
$$
\normalsize
\textbf{Probability Basics:} ($f_X = $ PDF of $X$)
$$
f_X \dd x = \frac{f_X}{|\dd y / \dd x|} \dd y, \ \
\mathrm{Skew}(X) = \mathbb E \left[ \left(\frac{X-\mu}{\sigma}\right)^3 \right], \ \
\mathrm{Kurt}(X) = \mathbb E \left[ \left(\frac{X-\mu}{\sigma}\right)^4 \right] - 3
$$
\begin{tabular}{ r c c c l }
\hline
$X$ & \textbf{PDF:} $f_X(x)$ & $\mathbb E[X]$ & $\var(X)$ \\ \hline
\textbf{Uniform distribution:} & $[[1 \geq x \geq 0]]$ & $\frac 1 2$ & $\frac 1 {12}$ \\
\textbf{Normal distribution:} & $\frac{1}{\sqrt{2\pi}\sigma} \exp(-\frac{(x-\mu)^2}{2\sigma^2})$ & $\mu$ & $\sigma^2$ \\
\textbf{LogNormal distribution:} & $\frac{1}{\sqrt{2\pi}\sigma x} \exp(-\frac{(\ln x-\mu)^2}{2\sigma^2})$ & $\exp(\mu+\sigma^2/2)$ & \scriptsize$(\exp(\sigma^2)-1)\exp(2\mu+\sigma^2)$\normalsize \\
\textbf{Cauchi distribution:} & $\frac{A}{\pi A^2 + x^2}$ & undef. & undef. \\
\\ \hline
$X$ & \textbf{PMF:} $f_X(k)$ & $\mathbb E[X]$ & $\var(X)$ \\ \hline
\textbf{Bernoulli distribution:} & $p[[k=1]] + q[[k=0]$ & $p$ & $pq$ & $q=1-p$ \\
\textbf{Binomial distribution:} & ${n \choose k}p^k q^{n-k}$ & $np$ & $npq$ & sum of $n$ IID Bernouilli\\
\textbf{Poisson distribution:} & $\frac{e^{-\lambda}\lambda^k}{k!}$ & $\lambda$ & $\lambda$ & $\lambda = \#/t$ \\
\textbf{Geometric distribution:} & $(1-p)^{k-1} p$ & $1/p$ & $\frac{1-p}{p^2}$ \\
\end{tabular}
\scriptsize
\end{multicols*}
\end{document}
@zaz
Copy link
Author

zaz commented Sep 27, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment