# Author Archives: Sung Lee

## About Sung Lee

I am a mathematician and a physics buff. I am interested in studying mathematics inspired by theoretical physics as well as theoretical physics itself. Besides, I am also interested in studying theoretical computer science.

# Vectors

What is a vector?

A vector is a quantity that has both direction and magnitude. Examples of vectors include displacement, velocity, force, weight, momentum, etc. A quantity that has only magnitude is called a scalar. Scalars are really just numbers. Examples of scalars include distance, speed, mass, temperature, etc. Since a vector has both direction and magnitude, it can be visually represented by a directed arrow. For instance, if a particle moves from a point $A$ to another point $B$, its displacement (i.e. the shortest distance from $A$ to $B$) is denoted by $\overrightarrow{AB}$ and it is visually represented by a directed arrow as in Figure 1.

The direction at which the arrow is pointing is the direction of the vector $\overrightarrow{AB}$ and the length of the arrow is the magnitude of the vector $\overrightarrow{AB}$. When it is not necessary to specify the initial point and the terminal point, a vector is denoted by a lower case alphabet letter with arrow on top like $\vec v$ or in boldface like ${\bf v}$.

Two vectors are said to be the same or equivalent if they have the same direction and the magnitude regardless of where they are located. If vectors $\overrightarrow{AB}$ and $\overrightarrow{CD}$ are the same, we write $\overrightarrow{AB}=\overrightarrow{CD}$. Figure 2 shows two equivalent vectors $\overrightarrow{AB}$ and $\overrightarrow{CD}$.

The equivalence of two vectors implies that a vector can be moved around maintaining its characters (direction and magnitude) so it stays as the same vector although its location has changed (meaning its initial and terminal points have changed). Moving a vector without changing direction and magnitude is called a parallel translation.

There are two types of operations on vectors. One is vector addition and the other is scalar multiplication. Vector addition is defined pictorially by using a parallelogram or a triangle. Figure 3 shows vector addition $$\overrightarrow{AB}+\overrightarrow{AC}=\overrightarrow{AD}$$ by using a parallelogram.

Figure 4 shows vector addition $$\overrightarrow{AB}+\overrightarrow{BC}=\overrightarrow{AC}$$ by using a triangle. The two ways of adding two vectors are indeed equivalent. The only difference is how you locate two vectors to add them together.

Scalar multiplication is a product between a scalar and a vector. While many people, even some (less careful) mathematicians, consider it as an operation, it is not an operation but an action. I am not going to talk about what an action is here. In case someone is curious, you can visit the Wikipedia page on Group Action here. In calculus level, distinction between an operation and an action is not really important at all. Let $c$ be a scalar and $v$ a vector. What the scalar multiplication $c{\bf v}$ does is, depends on the value of $c$, it can stretch (when $c>1$), shrink (when $0<c<1$), or reverse the direction (when $c=-1$) of vector ${\bf v}$ as illustrated in Figure 5.

Using vector addition and scalar multiplication, one can define subtraction of a vector ${\bf v}$ from another vector ${\bf u}$: $${\bf u}-{\bf v}:={\bf u}+(-{\bf v})$$ See Figure 6.

Earlier I mentioned that a vector can be moved around while preserving its direction and magnitude, and a parallel translation of a vector is still considered to be the same as the previous vector, although it is now at a different location. Among all those same vectors, we are particularly interested in vectors that are starting the origin $O$. Figure 7 shows an example of such a vector.

A vectors whose initial point is the origin $O$ is called a position vector or a located vector. A position vector is determined only by its terminal point, thereby it can be identified with a point in space and conversely a point in space can be identified with a position vector. For example, if the terminal point of a position vector ${\bf v}$ is $(a_1,a_2,a_3)$, then we regard them the same i.e. ${\bf v}=(a_1,a_2,a_3)$. Why this is such a big deal? The directed arrow representation of a vector has a lot of limitations. The most severe limitation is that it can only be useful when we can see them, i.e. their usage is limited within 3-dimensions as our perception does not allow us to go beyond 3-dimensions. However, Einstein’s theory of relativity (which has also been confirmed by numerous experiments and observations) that our universe is actually 4-dimensional. But that’s the universe we observe right now. String theory tells us that the universe can have up to 26-dimensions. It does not have to go that far beyond though. There are many other places here down on earth including computer science, economics, etc. where the notions of vectors in higher dimensions are being used. Considering position vectors resolve the limitation. Furthermore, now that we identify vectors with points in space and points are represented by ordered $n$-tuples (ordered pairs, triples, quadruples, depending on the dimension of the space) which are algebraic objects, we can use the power of algebra to describe the properties of vectors.

Given the points $A(a_1,a_2,a_3)$ and $B(b_1,b_2,b_3)$, the vector ${\bf v}$ which is represented by the directed arrow $\overrightarrow{AB}$ is $${\bf v}=(b_1-a_1,b_2-a_2,b_3-a_3)$$

Example. Find the vector represented by the directed arrow with initial point $A(2,-3,4)$ and $B(-2,1,1)$.

Solution. ${\bf v}=(-2-2,1-(-3),1-4)=(-4,4,-3)$.

The length or magnitude of a vector ${\bf v}$ is denoted by $|{\bf v}|$. For a vector ${\bf v}=(v_1,v_2)$ in the plane, $|{\bf v}|$ is given by $$|{\bf v}|=\sqrt{v_1^2+v_2^2}$$ (It’s easy to see this from Figure 7 using the Pythagorean law.) Similarly, for a vector ${\bf v}=(v_1,v_2,v_3)$ in space, $$|{\bf v}|=\sqrt{v_1^2+v_2^2+v_3^3}$$ It follows from the definition that $$\label{eq:length}|c{\bf v}|=|c||{\bf v}|$$ where $c$ is a scalar.

Vector addition and scalar multiplication can be nicely defined algebraically without using parallelograms or triangles. Furthermore, these algebraic definitions apply to vectors in arbitrary $n$-dimensional space. For vectors ${\bf u}=(u_1,u_2,u_3)$, ${\bf v}=(v_1,v_2,v_3)$ and a scalar $c$, \begin{align*}{\bf u}+{\bf v}&:=(u_1+v_1,u_2+v_2,u_3+v+3)\\c{\bf u}&:=(cu_1,cu_2,cu_3)\end{align*}

Example. If ${\bf u}=(4,0,3)$ and ${\bf v}=(-2,1,5)$, find $|{\bf u}|$, ${\bf u}+{\bf v}$, ${\bf u}-{\bf v}$, $3{\bf v}$, $2{\bf u}+5{\bf v}$.

Solution. \begin{align*}|{\bf u}|&=\sqrt{4^2+0^2+3^3}=\sqrt{25}=5\\{\bf u}+{\bf v}&=(4+(-2),0+1,3+5)=(2,1,8)\\{\bf u}-{\bf v}&=(4-(-2),0-1,3-5)=(6,-1,-2)\\3{\bf v}&=(3(-2),3(1),3(5))=(-6,3,15)\\2{\bf u}+5{\bf v}&=(2(4),2(0),2(3))+(5(-2),5(1),5(5))=(8,0,6)+(-10,5,25)=(-2,5,31)\end{align*}

Theorem. Let ${\bf u}$, ${\bf v}$, and ${\bf w}$ be vectors in $n$-dimensional space and $c$ and $d$ are scalars. Then

1. ${\bf u}+{\bf v}={\bf v}+{\bf u}$
2. ${\bf u}+({\bf v}+{\bf w})=({\bf u}+{\bf v})+{\bf w})$
3. ${\bf u}+{\bf 0}={\bf u}$, where ${\bf 0}=(0,0,\cdots,0)$
4. ${\bf u}+(-{\bf u})={\bf 0}$
5. $c({\bf u}+{\bf v})=c{\bf u}+c{\bf v}$
6. $(c+d){\bf u}=c{\bf u}+d{\bf u}$
7. $(cd){\bf u}=c(d{\bf u})$
8. $1{\bf u}={\bf u}$

It turns out the the original definition of vectors as quantities that have both direction and magnitude is quite obsolete and that even the definition of vectors by ordered $n$-tuples is not adequate enough to address much needed a broader notion of vectors arising in modern physics and engineering. For this reason, in modern treatment of vectors we no longer define what an individual vector is but instead we define a vector space. Simply speaking, a set $V$ with addition $+$ and scalar multiplication $\cdot$ satisfying the properties 1-8 is called a vector space, and the elements of $V$ are called vectors. Under this broader notion of vectors, things that were previously inconceivable to become vectors are now considered vectors. For example, $V$ the set of all continuous real-valued functions on the closed interval $[0,1]$ with addition $+$ and scalar multiplication $\cdot$ are defined by: \begin{align*}(f+g)(x)&:=f(x)+g(x)\\(cf)(x)&:=cf(x)\end{align*} for $f,g\in V$ and a scalar $c$. Then it is straightforward to show that the properties 1-8 are satisfied and therefore, $(V,+,\cdot)$ is a vector space and we regard continuous real-valued functions on $[0,1]$ as vectors. In fact, in quantum mechanics wave functions are state vectors. Another example is signal processing where functions are regarded as vectors. We are not going to delve into vector spaces further here. It is a main topic of linear algebra. For those who are curious, more examples of vector spaces can be found here.

There are infinitely many vectors. So it is humanly impossible to check if a certain property regarding vectors holds for all vectors. However there a particular finite set of vectors, called a basis, that constitute the entire vectors. A vector ${\bf u}=(u_1,u_2,u_3)$ can be written as $$\label{eq:lincomb}{\bf u}=u_1(1,0,0)+u_2(0,1,0)+u_3(0,0,1)$$ So we see that any vector can be represented by the three vectors $${\bf i}=(1,0,0),\ {\bf j}=(0,1,0),\ {\bf k}=(0,0,1)$$ by applying vector addition and scalar multiplication finitely many times as in \eqref{eq:lincomb}. The expression on the right hand side of the identity in \eqref{eq:lincomb} is called a linear combination or a superposition of ${\bf i}$, ${\bf j}$, ${\bf k}$. The three vectors ${\bf i}$, ${\bf j}$, ${\bf k}$ are called the canonical or standard basis vectors.

The number of standard basis vectors determines the dimension of the space. The dimension of a space is not necessarily finite though we are considering only finite dimensional spaces here (actually only 2- or 3-dimensional spaces). The set $V$ of all continuous functions on $[0,1]$ is infinite dimensional. The set of all state vectors in a quantum mechanics system is, in general, an infinite dimensional space called a Hilbert space.

Example. If ${\bf u}={\bf i}+2{\bf j}-3{\bf k}$ and ${\bf v}=4{\bf i}+7{\bf k}$, express $2{\bf u}+3{\bf v}$ in terms of ${\bf i}$, ${\bf j}$, ${\bf k}$.

Solution. \begin{align*}2{\bf u}+3{\bf v}&=2({\bf i}+2{\bf j}-3{\bf k})+3(4{\bf i}+7{\bf k})\\&=2{\bf i}+4{\bf j}-6{\bf k}+12{\bf i}+21{\bf k}\\&=14{\bf i}+4{\bf j}+15{\bf k}\end{align*}

Often in geometry and physics, we are only interested in the direction of a vector. A unit vector is a vector with length 1. Any non-zero vector can be re-scaled to a unit vector with the same direction. All that’s required is dividing the given vector by its magnitude. If ${\bf u}\ne {\bf 0}$, then $$\hat{\bf u}:=\frac{{\bf u}}{|{\bf u}|}$$ is a unit vector which has the same direction as ${\bf u}$: Using \eqref{eq:length}, $$|\hat{\bf u}|=\left|\frac{{\bf u}}{|{\bf u}|}\right|=\frac{1}{|{\bf u}|}|{\bf u}|=1$$

Example. Find the unit vector in the direction of the vector $2{\bf i}-{\bf j}-2{\bf k}$.

Solution. The length of the vector is $\sqrt{2^2+(-1)^2+(-2)^2}=\sqrt{9}=3$. Hence the unit vector with the same direction is $$\frac{2}{3}{\bf i}-\frac{1}{3}{\bf j}-\frac{2}{3}{\bf k}$$

In physics, when several forces are acting on an object, the resultant force or the net force experienced by the object is the vector sum of these forces.

Example. A 100-lb weight hangs from two wires as shown in Figure 9. Find the tension forces ${\bf T}_1$ and ${\bf T}_2$ in both wires and their magnitudes.

Solution. We first express the tensions ${\bf T}_1$ and ${\bf T}_2$ in terms of their horizontal and vertical components (the vectors in green in Figure 10).

\begin{align}\label{eq:tension1}{\bf T}_1&=-|{\bf T}_1|\cos 50^\circ{\bf i}+|{\bf T}_1|\sin 50^\circ{\bf j}\\\label{eq:tension2}{\bf T}_2&=|{\bf T}_2|\cos 32^\circ{\bf i}+|{\bf T}_2|\sin 32^\circ{\bf j}\end{align} The net force ${\bf T}_1+{\bf T}_2$ of the tensions must counterbalance the weight ${\bf w}$ so that the mass stays hung as in the figure, i.e. $${\bf T}_1+{\bf T}_2=-{\bf w}=100{\bf j}$$ From equations \eqref{eq:tension1} and \eqref{eq:tension2}, we have $$(-|{\bf T}_1|\cos 50^\circ+|{\bf T}_2|\cos 32^\circ){\bf i}+(|{\bf T}_1|\sin 50^\circ+|{\bf T}_2|\sin 32^\circ){\bf j}=100{\bf j}$$ By comparing the components, we obtain the following equations: \begin{align*}-|{\bf T}_1|\cos 50^\circ+|{\bf T}_2|\cos 32^\circ&=0\\|{\bf T}_1|\sin 50^\circ+|{\bf T}_2|\sin 32^\circ&=100\end{align*} Solving these equations simultaneously we find \begin{align*}|{\bf T}_1|&=\frac{100}{\sin 50^\circ+\tan 32^\circ\cos 50^\circ}\approx 85.64\mathrm{lb}\\|{\bf T}_2|&=\frac{|{\bf T}_1|\cos 50^\circ}{\cos 32^\circ}\approx 64.91\mathrm{lb}\end{align*} Therefore, $${\bf T}_1\approx -55.05{\bf i}+65.60{\bf j},\ {\bf T}_2\approx 55.05{\bf i}+34.40{\bf j}$$

Examples in this note have been taken from [1].

References.

[1] Calculus, Early Transcendentals, James Stewart, 6th Edition, Thompson Brooks/Cole

# Introductory Probability: Random Variables and Expectation

Let us begin with an example.

Example. Consider an experiment of tossing 3 fair coins. Let $X$ denote the number of heads appearing. Then $X$ takes on one of the values 0, 1, 2, 3 with respective probabilities: \begin{align*}P_r\{X=0\}&=P_r\{(T,T,T)\}=\frac{1}{8}\\P_r\{X=1\}&=P_r\{(T,T,H),(T,H,T),(H,T,T)\}=\frac{3}{8}\\P_r\{X=2\}&=P_r\{(T,H,H),(H,T,H),(H,H,T)\}=\frac{3}{8}\\P_r\{X=3\}&=P_r\{(H,H,H)\}=\frac{1}{8}\end{align*} This $X$ here is an example of what is called a random variable. Random variables are real-valued functions defined on the sample space $S$ i.e. $X: S\longrightarrow\mathbb{R}$. In this example, $X$ is the function $X: S\longrightarrow\{0,1,2,3\}$ with $S=\{(T,T,T),(T,T,H),(T,H,T),(H,T,T),(T,H,H),(H,T,H),(H,H,T),(H,H,H)\}$ defined by the number of heads appearing for each outcome. In probability, often we are more interested in the values of a random variable rather than the outcomes of an experiment.

Remark. In more traditional mathematical notation, $P_r\{X=i\}$ is denoted by $P_r\{X^{-1}(i)\}$ which means $$P_r\{X^{-1}(i)\}=P_r\{s\in S: X(s)=i\}$$ But in probability, $P_r\{X=i\}$ is commonly used notation.

Here is another example.

Example. Three marbles are randomly selected from a jar containing 3 white, 3 red, and 5 black marbles. Suppose that we win \$1 for each white marble selected and lose \$1 for each red marble selected. Let $X$ denote the total winnings from the experiment. Then $X$ is a random variable taking on the values $0,\pm 1,\pm 2,\pm3$ with respective probabilities: \begin{align*}P_r\{X=0\}&=\frac{\begin{pmatrix}5\\3\end{pmatrix}+\begin{pmatrix}3\\1\end{pmatrix}\begin{pmatrix}3\\1\end{pmatrix}\begin{pmatrix}5\\1\end{pmatrix}}{\begin{pmatrix}11\\3\end{pmatrix}}=\frac{55}{165}\\P_r\{X=1\}=P_r\{X=-1\}&=\frac{\begin{pmatrix}3\\1\end{pmatrix}\begin{pmatrix}5\\2\end{pmatrix}+\begin{pmatrix}3\\2\end{pmatrix}\begin{pmatrix}3\\1\end{pmatrix}}{\begin{pmatrix}11\\3\end{pmatrix}}=\frac{39}{165}\\P_r\{X=2\}=P_r\{X=-2\}&=\frac{\begin{pmatrix}3\\2\end{pmatrix}\begin{pmatrix}5\\1\end{pmatrix}}{\begin{pmatrix}11\\3\end{pmatrix}}=\frac{15}{165}\\P_r\{X=3\}=P_r\{X=-3\}&=\frac{\begin{pmatrix}3\\3\end{pmatrix}}{\begin{pmatrix}11\\3\end{pmatrix}}=\frac{1}{165}\end{align*} The probability that we win money is $$\sum_{i=1}^3P_r\{X=i\}=\frac{55}{165}=\frac{1}{3}$$

Definition. Let $\mathrm{PMF}_X(i):=P_r\{X=i\}$. $\mathrm{PMF}_X(i)$ is called the probability mass function for random variable $X$.

Definition. Let $\mathrm{CDF}_X(i):=P_r\{X\leq i\}$. $\mathrm{CDF}_X(i)$ is called the cumulative distribution function and it describes the probability that the value of a random variable is below a specified number.

$\mathrm{CDF}_X(i)$ can be expressed as $$\mathrm{CDF}_X(i)=\sum_{j\leq i}\mathrm{PMF}_X(j)$$ i.e. it is the accumulation of distribution (probability) described by the probability mass function for values up to $i$, hence the name the cumulative distribution function.

Example. How likely is it that it will take no more than 3 flips for a coin to land on heads?

Solution. Let $X$ denote the number of heads appearing. Then what the question is asking is $P_r\{X\leq 3\}$ i.e. $\mathrm{CDF}_X(3)$. \begin{align*}\mathrm{CDF}_X(3)&=\sum_{j=1}^3\mathrm{PMF}_X(j)\\&=\sum_{j=1}^3 P_r\{X=j\}\\&=\frac{1}{2}+\frac{1}{4}+\frac{1}{8}=\frac{7}{8}\end{align*}

Definition. The expected value of a random variable $X$, denoted by $E(X)$, is the weighted average of its possible values weighted according to their probabilities. More specifically, $$E(X)=\sum_i\mathrm{PMF}_X(i)\cdot i=\sum_i P_r\{X=i\}\cdot i$$ The expected value is also called the expectation or the mean.

Example. What is the expected value of a roll of a die?

Solution. The random variable $X$ takes on values 1, 2, 3, 4, 5, 6 and each of these values has equal proprobability of $\frac{1}{6}$. Hence, the expected value of $X$ is $$E(X)=\sum_{i=1}^6\frac{1}{6}i=\frac{1}{6}\frac{6\cdot 7}{2}=3.5$$ Here I used the formula $$1+2+3+\cdots+n=\frac{n(n+1)}{2}$$ to calculate $1+2+3+4+5+6$.

Example. If a die is rolled three times, how many distinct values are expected to appear?

Solution. Let $X$ denote the number of distinct values. There are $6^3$ outcomes of this experiment. Calculating $P_r\{X=1\}$ and $P_r\{X=3\}$ are straightforward. \begin{align*}P_r\{X=1\}&=\frac{\begin{pmatrix}6\\1\end{pmatrix}}{6^3}=\frac{1}{36}\\P_r\{X=3\}&=\frac{\begin{pmatrix}6\\3\end{pmatrix}}{6^3}=\frac{5}{54}\end{align*} $P_r\{X=2\}$ can be found by $$P_r\{X=2\}=1-P_r\{X=1\}-P_r\{X=3\}=1-\frac{1}{36}-\frac{5}{54}=\frac{95}{108}$$ The expected value is then \begin{align*}E(X)&=P_r\{X=1\}\cdot 1+P_r\{X=2\}\cdot 2+P_r\{X=3\}\cdot 3\\&=\frac{1\cdot 1}{36}+\frac{95\cdot 2}{108}+\frac{5\cdot 3}{54}=\frac{223}{108}\approx 2.06\end{align*}

Example. Let $X$ denote the number of heads appearing in a sequence of 10 flips of a coin. What is $E(X)$?

Solution. For any $i=0,1,\cdots,10$, there are $\begin{pmatrix}10\\i\end{pmatrix}$ sequences of 10 flips, each of which contains $i$ heads. Each such sequence happens with probability $\left(\frac{1}{2}\right)^{10}$. Hence, \begin{align*}E(X)&=\sum_{i=0}^{10}P_r\{X=i\}\cdot i\\&=\sum_{i=1}^{10}P_r\{X=i\}\cdot i\\&=\sum_{i=1}^{10}\begin{pmatrix}10\\i\end{pmatrix}\left(\frac{1}{2}\right)^{10}\cdot i\\&=\left(\frac{1}{2}\right)^{10}\cdot 10\cdot 2^9\\&=5\end{align*} For the second line to the last, I used the identity $$\label{eq:binom2}\sum_{k=1}^n\begin{pmatrix}n\\k\end{pmatrix}k=n2^{n-1}$$ The equation \eqref{eq:binom2} can be easily seen. \begin{align*}\sum_{k=1}^n\begin{pmatrix}n\\k\end{pmatrix}k&=\sum_{k=1}^n\frac{n!}{(k-1)!(n-k)!}\\&=n\sum_{k=1}^n\frac{(n-1)!}{(k-1)!(n-1-(k-1))!}\\&=n\sum_{k=1}^n\begin{pmatrix}n-1\\k-1\end{pmatrix}\\&=n2^{n-1}\end{align*} The last expression is obtain using the equation (4) here.

While the expected value $E(X)$ provides useful information as the weighted average of the possible values of $X$. But it does not provide information on the spread of these values. The variance provides such information.

Definition. If $X$ is a random variable with expected value $E(X)$, then the variance of $X$, denoted by $\mathrm{Var}(X)$, is defined by $$\mathrm{Var}(X)=E[(X-E(X))^2]$$

To simplify our calculation, let us denote $E(X)$ by $\mu$. Then \begin{align*}\mathrm{Var}(X)&=E[(x-\mu)^2]\\&=\sum_iP_r\{X=i\}(i-\mu)^2\end{align*} This last expression shows that $\mathrm{Var}(X)$ measures how far apart $X$ would be from its expected value on the average. Let us continue further from the last expression above. \begin{align*}\sum_iP_r\{X=i\}(i-\mu)^2&=\sum_iP_r\{X=i\}(i^2-2\mu i+\mu^2)\\&=\sum_iP_r\{X=i\}i^2-2\mu\sum_iP_r\{X=i\}i+\mu^2\sum_iP_r\{X=i\}\\&=E(X^2)-2\mu^2+\mu^2\\&=E(X^2)-\mu^2\\&=E(X^2)-[E(X)]^2\end{align*} So we have an alternative formula for the variance $$\label{eq:variance}\mathrm{Var}(X)=E(X^2)-[E(X)]^2$$

Example. Calculate $\mathrm{Var}(X)$ if $X$ represents the outcome when a die is rolled.

Solution. First \begin{align*}E(X)&=1\cdot\frac{1}{6}+2\cdot\frac{1}{6}+3\cdot\frac{1}{6}+4\cdot\frac{1}{6}+5\cdot\frac{1}{6}+6\cdot\frac{1}{6}\\&=\frac{1}{6}\frac{6\cdot 7}{2}=\frac{7}{2}\end{align*} Next, \begin{align*}E(X^2)&=1^2\cdot\frac{1}{6}+2^2\cdot\frac{1}{6}+3^2\cdot\frac{1}{6}+4^2\cdot\frac{1}{6}+5^2\cdot\frac{1}{6}+6^2\cdot\frac{1}{6}\\&=\frac{1}{6}\frac{6\cdot 7\cdot 13}{6}=\frac{91}{6}\end{align*} The value in the second line to the last is obtained by the formula $$1^2+2^2+3^2+\cdots+n^2=\frac{n(n+1)(2n+1)}{6}$$ Therefore, $$\mathrm{Var}(X)=\frac{91}{6}-\left(\frac{7}{2}\right)^2=\frac{35}{12}$$

Remarks.

1. In mechanics, the center of gravity of a system of particles is indeed the expected value of the position coordinates of particles. Also the moment of inertia of a body is the variance of the position coordinates of particles that constitute the body.
2. $\mathrm{SD}(X)=\sqrt{\mathrm{Var}(X)}$ is called the standard deviation of $X$.

I will complete this note with the following useful identities.

Theorem. Let $a$ and $b$ be constant. Then

1. $E(aX+b)=aE(X)+b$. As a special case, if $b=0$, we obatin $E(aX)=aE(X)$.
2. $\mathrm{Var}(aX+b)=a^2\mathrm{Var}(X)$.

Proof.

1. \begin{align*}E(aX+b)&=\sum_iP_r\{X=i\}(ai+b)\\&=a\sum_iP_r\{X=i\}i+b\sum_iP_r\{X=i\}\\&=aE(X)+b\end{align*}
2. For simplicity, let $\mu=E(X)$. Then by the theorem 1 above, $E(aX+b)=a\mu+b$. Now, \begin{align*}\mathrm{Var}(aX+b)&=E[(aX+b-a\mu-b)^2]\\&=E[a^2(X-\mu)^2]\\&=a^2E[(X-\mu)^2]\\&=a^2\mathrm{Var}(X)\end{align*}

References.

[1] Essential Discrete Mathematics for Computer Science, Harry Lewis and Rachel Zax, Princeton University Press, 2019

[2] A First Course in Probability, Sheldon Ross, 5th Edition, Prentice-Hall, 1998

# Introductory Probability: Baye’s Theorem

Let $S$ be sample space and $E, F$ events. The event $E$ can be written as \begin{align*}E&=E\cap S\\&=E\cap(F\dot\cup F^c)\\&=(E\cap F)\dot\cup(E\cap F^c)\end{align*} By axiom 3 of finite probability, we have \begin{aligned}P_r(E)&=P_r(E\cap F)+P_r(E\cap F^c)\\&=P_r(E|F)P(F)+P_r(E|F^c)P(F^c)\\&=P_r(E|F)P_r(F)+P_r(E|F^c)(1-P_r(F))\end{aligned}\label{eq:baye} This equation states that the probability of the event $E$ is a weighted average of the conditional probability of $E$ given that $F$ has happened and the conditional probability of $E$ given that $F$ has not occurred. The equation \eqref{eq:baye} is useful because often it is difficult to calculate the probability of the even $E$ directly but knowing the information on whether the other event $F$ has happened helps us to determine the probability of $E$.

Example. An insurance company divides people into two categories: those who are accident prone and those who are not. A statistics shows that an accident-prone person will have an accident at some time within a fixed 1-year period with probability 0.4. This probability decreases to 0.2 for a non-accident-prone person. If 30% of the population is accident prone, what is the probability that a new policyholder will have an accident within a year of purchasing a policy?

Solution. Let $E$ denote the event that the policyholder will have an accident within a year of purchase. Let $F$ denote the event that the policyholder is accident prone. Using the equation \eqref{eq:baye}, \begin{align*}P_r(E)&=P_r(E|F)P_r(F)+P_r(E|F^c)P_r(F^c)\\&=0.4\times 0.3+0.2\times 0.7\\&=0.26\end{align*}

Suppose that $P_r(E)$ and $P_r(F)$ are both nonzero. Then it follow from the conditional probabilities $$P_r(E|F)=\frac{P_r(E\cap F)}{P_r(F)},\ P_r(F|E)=\frac{P_r(F\cap E)}{P_r(E)}$$ that $$\label{eq:baye2}P_r(E|F)=\frac{P_r(F|E)P_r(E)}{P_r(F)}$$ The equation \eqref{eq:baye2} is usually called Baye’s Theorem, named after an English statistician and a philosopher Reverend Thomas Bayes (pronounced ‘beiz’). If we regard the event $E$ as a hypothesis and $F$ as an evidence, the probabilities $P_r(E)$ and $P_r(E|F)$ can be interpreted, respectively, as the initial degree of belief in $E$ and the degree of belief in $E$ after having accounted the evidence $F$. The factor $\frac{P_r(F|E)}{P_r(F)}$ can then be interpreted as the support $F$ provides for $E$.

Example. This is the second part of the previous example. Suppose that a new policyholder has an accident within a year of purchasing a policy. What is the probability that he or she is accident prone?

Solution. What the question is asking is $P_r(F|E)$. By Baye’s theorem \eqref{eq:baye2}, \begin{align*}P_r(F|E)&=\frac{P_r(E|F)P_r(F)}{P_r(E)}\\&=\frac{0.4\times 0.3}{0.26}=\frac{6}{13}\end{align*} i.e. 6 out of 13 who have an accident within a year of purchasing a policy are accident-prone people.

Example. A lab blood test is 95% effective in detecting a certain disease when it is present. The test also yields a false positive result for 1% of the healthy people tested. If 0.5% of the population actually has the disease, what is the probability a person has the disease given that the test result is positive.

Solution. Let $D$ be the event that the tested person has the disease and $E$ the event that the test result is positive. What is asked is to find $P_r(D|E)$. The available information is $P_r(E|D)=0.95$, $P_r(D)=0.005$, and $P_r(E|D^c)=0.01$. Using Baye’s theorem \eqref{eq:baye2} along with \eqref{eq:baye}, \begin{align*}P_r(D|E)&=\frac{P_r(E|D)P_r(D)}{P_r(E|D)P_r(D)+P_r(E|D^c)P_r(D^c)}\\&=\frac{0.95\times 0.005}{0.95\times 0.005+0.01\times 0.995}\\&=\frac{95}{294}\approx 0.323\end{align*} i.e. only 32% of those who tested positive actually have the disease.

Example. During a criminal investigation, the detective in charge is 60% convinced that a suspect is guilty. Now a new piece of evidence comes into light and it shows that the criminal has a certain characteristic (such as left-handedness, baldness, or brown hair). Suppose that 20% of the population possesses this characteristic. It turns out that the suspect does have this characteristic, how certain is the detective now that the suspect is guilty of the crime?

Solution. Let $G$ be the event that the suspect is guilty and $C$ the event that he possesses the characteristic of the criminal. What is asked is to find $P_r(G|C)$. The available information is then $P_r(G)=0.6$, $P_r(C|G^c)=0.2$, and $P_r(C|G)=1$ (The real criminal does have the characteristic.) Using Baye’s theorem \eqref{eq:baye2} along with \eqref{eq:baye}, \begin{align*}P_r(G|C)&=\frac{P_r(C|G)P_r(G)}{P_r(C|G)P_r(G)+P_r(C|G^c)P(G^c)}\\&=\frac{1\times 0.6}{1\times 0.6+0.2\times 0.4}\\&\approx 0.882\end{align*}

References.

[1] Essential Discrete Mathematics for Computer Science, Harry Lewis and Rachel Zax, Princeton University Press, 2019

[2] A First Course in Probability, Sheldon Ross, 5th Edition, Prentice-Hall, 1998

# Introductory Probability: Conditional Probability

A conditional probability is the probability that an event will occur on the condition that some other event occurs. For example, the odds of rolling two 1s with two dice are $\frac{1}{36}$. Rolls of two dice are independent events, but if we know the roll of at least one of the dice is an odd number, then the likelihood of two 1s increases.

Definition. Let $A$ and $B$ be events. Suppose $P_r(B)>0$. Then the conditional probability of $A$ given $B$ is $$\label{eq:condprob}P_r(A|B)=\frac{P_r(A\cap B)}{P_r(B)}$$ If $P_r(B)=1$, then knowing the event $B$ occurs gives no information on event $A$ and $P_r(A|B)=P_r(A)$. If $P_r(B)<1$, then knowing event $B$ happened increases the probability of event $A$ happened by $\frac{1}{P_r(B)}$.

As a special case, if all outcomes are equally likely, then \begin{align*}P_r(A|B)&=\frac{P_r(A\cap B)}{P_r(B)}\\&=\frac{\frac{|A\cap B|}{|S|}}{\frac{B|}{|S|}}\\&=\frac{|A\cap B|}{|B|}\end{align*}

Example. (Rolling two 1s with two dice) The sample space is $\{1,2,3,4,5,6\}\times\{1,2,3,4,5,6\}$ and $A=\{(1,1)\}$. Let $B$ be the event that one of the dice has come up with an odd number. Then $$B=\{1,3,5\}\times\{1,2,3,4,5,6\}\cup\{1,2,3,4,5,6\}\times\{1,3,5\}$$ $|B|=27$ and $A\cap B=A$, so we obtain $$P_r(A|B)=\frac{1}{27}>\frac{1}{36}$$

Example. If a die is rolled twice, what is the probability that the sum of rolls is at least 9? If the first roll is a 4, does the probability increase, decrease, or stay the same?

Solution. Let $A$ be the event that the rolls total at least 9. Then $$A=\{(3,6),(4,5),(4,6),(5,4),(5,5),(5,6),(6,3),(6,4),(6,5),(6,6)\}$$ and $P_r(A)=\frac{|A|}{|S|}=\frac{10}{36}=\frac{5}{18}$. Let $B$ be the event that the first roll is 4. Then $$B=\{(4,1),(4,2),(4,3),(4,4),(4,5),(4,6)\}$$ and $A\cap B=\{(4,5),(4,6)\}$. Thus, $$P_r(A|B)=\frac{|A\cap B|}{|B|}=\frac{2}{6}=\frac{1}{3}>\frac{5}{18}=P_r(A)$$

Example. A coin is flipped twice. What is the conditional probability that both flips result in heads, given that the first flip does?

Solution. Let $A$ be the event that both flips land head and $B$ the event that the first flip lands head. Then $$A=\{(H,H)\},\ B=\{(H,H),(H,T)\}$$ and so $P_r(A|B)=\frac{1}{2}$.

Example. An urn contains 10 white, 5 yellow, and 10 black marbles. A marble is chosen at random from the urn and it is noted it is not one of the black marbles. What is the probability that it is yellow?

Solution. Let $A$ be the event that the marble selected is yellow and $B$ the event that the marble selected is not black. $A\cap B=A$ so $P_r(A\cap B)=\frac{5}{25}$. Since $P_r(B)=\frac{15}{25}$, \begin{align*}P_r(A|B)&=\frac{P_r(A\cap B)}{P_r(B)}\\&=\frac{5}{15}\\&=\frac{1}{3}\end{align*}

Remark. In the above example, since we know that the chosen marble is not black, we can reduced our sample space by including only white and yellow marbles. Then the probability that a marble chosen at random is yellow is simply $P_r(A)=\frac{5}{15}=\frac{1}{3}$. When all outcomes are assumed to be equally likely, it is often easier to compute a conditional probability by reducing sample space instead of directly applying the formula \eqref{eq:condprob}.

Remark. (Independent Events and Conditional Probability) Recall that two events $A$ and $B$ are independent if and only if $P_r(A\cap B)=P_r(A)P_r(B)$. One can easily show that two events $A$ and $B$ with nonzero probabilities are independent if and only if $$P_r(A|B)=P_r(A)$$

References.

[1] Essential Discrete Mathematics for Computer Science, Harry Lewis and Rachel Zax, Princeton University Press, 2019

[2] A First Course in Probability, Sheldon Ross, 5th Edition, Prentice-Hall, 1998

# Introductory Probability: Outcomes, Events, Probability, Independence

Probability answers the following question. How frequently should we expect one outcome or another to occur if we repeat some procedure many times? First let’s introduce some terminologies that are frequently used in studying probability:

• Trial: a repeatable procedure such as tossing a coin or drawing a marble from a jar
• Experiment: a sequence of individual trials
• Sample space (of a trial): the set of all possible outcomes
• An event: any set of outcomes, so it is a subset of sample space

Example. Rolling a die is a trial. It’s sample space is the set $\{1,2,3,4,5,6\}$. The subset $\{2,4,6\}$ is an event.

A sample space in general can be an infinite set but we consider only finite sample space here. Let $S$ be a sample space. A probability function $P_r: \wp(S)\longrightarrow\mathbb{R}$ assigns probabilities to events. Any probability function must satisfy the axioms of finite probability:

1. $0\leq P_r(A)\leq 1$ for any event $A$.
2. $P_r(\emptyset)=0$ and $P_r(S)=1$.
3. For any events $A$ and $B$ with $A\cap B=\emptyset$, $$P_r(A\cup B)=P_r(A)+P_r(B)$$

Remark. Because of axiom 1, the codomain of a probability function $P_r$ can be restricted to the unit interval $[0,1]$, i.e. $P_r:\wp(S)\longrightarrow[0,1]$.

Theorem. The probability of an event $A$ not happening is $$P_r(A^c)=1-P_r(A)$$

Proof. It follows from $S=A\dot\cup A^c$ and axiom 3. Here, $\dot\cup$ means disjoint union.

Theorem. Let $A$ and $B$ be events such that $A\subseteq B$. Then $P_r(A)\leq P_r(B)$.

Proof. The set $B$ cam be written as $B=A\dot\cup(B-A)$, thus by axiom 3 $$P_r(B)=P_r(A)+P_r(B-A)\geq P_r(A)$$

This theorem is extended to

Theorem. Let $A_1,A_2,\cdots,A_n$ be events such that $A_i\cap A_j=\emptyset$ for $i\ne j$. Then $$P_r\left(\bigcup A_i\right)=\sum P_r(A_i)$$

Let $A$ and $B$ be two events and assume that $A$ and $B$ are not necessarily disjoint. How do we calculate $P_r(A\cup B)$, i.e. the probability of the event $A$ or $B$ happening? The following theorem answers that.

Theorem. (Inclusion-Exclusion Principle) Let $A$ and $B$ be two events (not necessarily disjoint). Then $$P_r(A\cup B)=P_r(A)+P_r(B)-P_r(A\cap B)$$

Proof. \begin{align*}A&=(A-B)\dot\cup(A\cap B)\\B&=(B-A)\dot\cup(A\cap B)\end{align*} Hence by axiom 3, we have \begin{align*}P_r(A-B)&=P_r(A)-P_r(A\cap B)\\P_r(B-A)&=P_r(B)-P_r(A\cap B)\end{align*} Also $A-B$, $B-A$ and $A\cap B$ are mutually disjoint, so by the previous theorem we have \begin{align*}P_r(A\cup B)&=P_r(A-B)+P_r(B-A)+P(A\cap B)\\&=P_r(A)+P_r(B)-P_r(A\cap B)\end{align*}

Consider a trial with $n$ possible outcomes. Assume that the outcomes are equally likely. Examples of trials with equally likely outcomes include coin tossing, rolling a die, drawing marbles from a jar, etc. Let $S$ be the sample space of a trial with equally likely outcomes. Define a function $P_r: \wp(S)\longrightarrow[0,1]$ by $$P_r(E)=\frac{|E|}{|S|}$$ for event $E$. Then it is straightforward to show that $P_r$ satiesfies axioms 1-3, i.e. it is a probability function.

Example. If a fair coin is flipped 4 times, what is the probability that exactly 2 of the flip’s land heads up?

Solution. $|S|=2^4=16$. Let $E$ be the set of outcomes that contain exactly 2 heads. Then $|E|=\begin{pmatrix}4\\2\end{pmatrix}=6$. Hence, $P_r(E)=\frac{6}{16}=\frac{3}{8}$.

Example. The Gambler’s Fallacy. Let $n$ be a large number. If a coin is flipped $n$ times and comes up heads the first $n-1$ times, what is the probability that the $n$th flip comes up head?

Solution. Although your intuition might tell you that the coin is due to come up tail, the coin doesn’t remember the history of previous outcomes. The probability is still $\frac{1}{2}$.

When the knowledge of whether an event $A$ occurred gives no information about whether another event $B$ occurred, $A$ and $B$ are said to be independent. Mathematically, the events $A$ and $B$ are independent if and only if $$P_r(A\cap B)=P_r(A)P_r(B)$$

Example. Let us consider $n=4$ case in the previous example. Let $A$ be the event that a coin is flipped 4 times and comes up heads first three times. Let $B$ be the event that a coin is flipped 4 times and comes up head last time. We show that $A$ and $B$ are independent events. Then \begin{align*}A&=\{HHHH,HHHT\}\\B&=\{HHHH,HHTH,HTHH,THHH,THTH,TTHH,TTTH\}\end{align*} Hence, \begin{align*}P_r(A\cap B)&=\frac{|A\cap B|}{|S|}=\frac{1}{16}\\P_r(A)P_r(B)&=\frac{|A|}{|S|}\frac{|B|}{|S|}=\frac{2}{16}\frac{8}{16}=\frac{1}{16}\end{align*} Since $P_r(A\cap B)=P_r(A)P_r(B)$, $A$ and $B$ are independent.

Example. Suppose three marbles are drawn from a jar containing six red marbles and four blue marbles. Let us consider the following events.

• $A$: The three marbles are not all the same color.
• $B$: The first marble drawn is red.

Are $A$ and $B$ independent?

Solution. The number of ways of drawing 3 marbles of the same color is $$\begin{pmatrix}6\\3\end{pmatrix}+\begin{pmatrix}4\\3\end{pmatrix}=24$$ So the number of ways of choosing 3 marbles that are not all the same color, i.e. $|A|=\begin{pmatrix}10\\3\end{pmatrix}-24=120-24=96$. Hence, $P_r(A)=\frac{96}{120}=\frac{4}{5}$. The probability that the first marble drawn is red is just $P_r(B)=\frac{6}{10}=\frac{3}{5}$. To calculate $P_r(A\cap B)$, since first marble is drawn red, the remaining two marbles drawn must contain at least one blue marble. There are $\begin{pmatrix}5\\2\end{pmatrix}=10$ ways of getting 2 more red marbles and so there are $\begin{pmatrix}9\\2\end{pmatrix}-10=36-10=26$ ways of drawing at least one blue marble. Therefore, $P_r(A\cap B)=\frac{6}{10}\frac{26}{36}=\frac{13}{30}$. On the other hand, $P_r(A)P_r(B)=\frac{4}{5}\frac{3}{5}=\frac{12}{25}$. Since $P_r(A\cap B)\ne P_r(A)P_r(B)$, the events $A$ and $B$ are not independent.

References.

[1] Essential Discrete Mathematics for Computer Science, Harry Lewis and Rachel Zax, Princeton University Press, 2019