[Home]
Last updated on: Wed Aug 19 12:37:28 IST 2026

Inequalities


$\newcommand{\rightarrowA}{\stackrel{a.s.}{\longrightarrow}}$ $\newcommand{\rightarrowP}{\stackrel{P}{\longrightarrow}}$ $\newcommand{\v}{\mathbf}$ $\newcommand{\cov}{\mathrm{cov}}$ Inequalities
Last updated on: Wed Aug 19 12:37:29 IST 2026

1. Cauchy-Schwarz

Cauchy-Schwarz inequality Let $X,Y$ be two jointly distributed random variables (i.e., both defined on the same probability space) with finite variances. Then $\cov(X,Y)^2 \leq V(X)V(Y).$ Equality holds iff $\exists a,b,c\in{\mathbb R}~~P(aX+bY=c)=1.$

Proof: Case 1: $V(X)=0$: Then $X$ is a constant (say $c$) with probability 1. So $E(X)=c.$

In this case, $$\cov(X,Y) = E\big( (X-E(X))(Y-E(Y)) \big) = E\big( (c-c) (Y-E(Y)) \big) = 0,$$ and so the inequality holds trivially (both sides being 0).

Case 2: $V(Y)=0$: Similar to Case 1.

Case 3: $V(X), V(Y)>0$:

Define $Z_1 = \frac{X-E(X)}{\sqrt{V(X)}}$ and $Z_2 = \frac{Y-E(Y)}{\sqrt{V(Y)}}.$

Notice that $E(Z_1^2) = E(Z_2^2) = 1$ and $E(Z_1Z_2) = \frac{\cov(X,Y)}{\sqrt{V(X)V(Y)}}.$

Now $$\begin{eqnarray*} & & E(Z_1\pm Z_2)^2 \geq 0\\ &\mbox{or } & E(Z_1^2) + E(Z_2^2) \pm 2E(Z_1Z_2) \geq 0\\ &\mbox{or } & 1 + 1 \pm \frac{2\cov(X,Y)}{\sqrt{V(X)V(Y)}}\geq 0\\ &\mbox{or } & 1 \pm \frac{\cov(X,Y)}{\sqrt{V(X)V(Y)}}\geq 0\\ &\mbox{or } & \pm \frac{\cov(X,Y)}{\sqrt{V(X)V(Y)}}\leq 1\\ &\mbox{or } & \left(\frac{\cov(X,Y)}{\sqrt{V(X)V(Y)}}\right)^2\leq 1\\ &\mbox{or } & \cov(X,Y)^2\leq V(X)V(Y), \end{eqnarray*}$$ as required.

Also equality holds iff $V(Z_1+Z_2)=0$ or $V(Z_1-Z_2)=0$, i.e., if $Z_1+Z_2$ or $Z_1-Z_2$ is a constant with probability 1.

So we have either $P(Z_1+Z_2=k)=1$ or $P(Z_1-Z_2=k)=1$ for some $k\in{\mathbb R}.$

In both cases we have $P(aX+bY=c)=1$ for some constants, $a,b,c,$ as required. [QED]

It is instructive to think about the Cauchy-Schwarz inequality from a geometric perspective. If we take two vectors , $\v u$ and $\v v$ in 2D or 3D, we have the identity $$\v u\bullet\v v = \| \v u\| \cdot \|\v v\|\cos \theta,$$ where $\theta$ is the angle between the two vectors.
Now, if we replace the two vectors by the random variables $X$ and $Y$, then their covariance plays the role of dot product. Indeed, covariance satisfies all the properties of a dot product (also called inner product in linear algebra). Then the role of length of a vector (called norm in linear algebra) is played by standard deviation, since $\|\v u\| = \sqrt{\v u\bullet\v u}.$

Similarly, $\sqrt{\cov(X,X)} = \sqrt{V(X)}.$

In this sense $\cos \theta = \frac{\cov(X,Y)}{\sqrt{V(X)V(Y)}}.$

Can we recover $\theta$ from this? Yes, using $\cos ^{-1},$ provided the RHS is between $-1$ and $1.$ Well, the Cauchy-Schwarz inequality guarantees precisely that. In this geometric interpretation, $\cos \theta$ is called the correlation coefficient between $X$ and $Y.$

1.1. Problem set

EXERCISE 1: Let $V(X) = 2$, $V(Y) = 4.5$ and $\cov(X,Y) = -3.$ If $E(X) = 1$, $E(Y) = 2,$ then find $a,b,c\in{\mathbb R}$ such that $P(aX+bY=c)=1.$

Hint:

Here equality holds in Cauchy-Schwarz inequality. Define $Z_1,Z_2$ as in the proof of Cauchy-Schwarz inequality. Either $V(Z_1+Z_2)=0$ or $V(Z_1-Z_2)=0.$ Which one?

EXERCISE 2: Here is another variant of the Cauchy-Schwarz inequality:

If $X,Y$ are jointly distributed random variables with $E(X^2),E(Y^2) < \infty,$ then $E^2(XY)\leq E(X^2)E(Y^2).$
Prove this.

Hint:

Just mimick the proof above. Cases 1 and 2 for $E(X^2)=0$ and $E(Y^2)=0.$ In case 3 take $Z_1=\frac{X}{\sqrt{E(X^2)}}$ and $Z_2=\frac{Y}{\sqrt{E(Y^2)}}.$

EXERCISE 3: $X$ is a nonnegative random variable with finite second moment. Show that $P(X>0)\geq \frac{E^2(X)}{E(X^2)}.$

Hint:

Take $Y = \left\{\begin{array}{ll}1&\text{if }X>0\\ 0&\text{otherwise.}\end{array}\right..$ Apply the form of Cauchy-Schwarz inequality in the last exercise.

EXERCISE 4: Let $X_1,...,X_n$ be random variables with finite second moments. Show that $$V\left(\sum X_i\right) \leq \left(\sum\sqrt{V(X_i)}\right)^2.$$

EXERCISE 5: Show that $E|X-E(X)|\leq \sqrt{V(X)}$ for any random variable $X$ with finite second moment.

EXERCISE 6: If $E(X^2)=E(Y^2) = E(XY),$ then show that $P(X=Y)=1.$

2. Markov and Chebyshev inequalities

Let us start with a commonsense example.

EXAMPLE 1: 10 nonnegative numbers have a total of 100. Three of the numbers are $\geq 35$. Can this statement be true?

SOLUTION: No, because just these three numbers already have a total exceeding 100. Since the other numbers are nonnegative, they cannot bring the total down!

You can think of it as trying to satisfy the given conditions using the smallest possible numbers:
So the lowest possible sum is $3\times35=105.$ Since the required sum falls below that minimum, it is impossible. ■

A slightly less trivial version of the same idea is used below.

EXAMPLE 2: Average salary in a company is Rs 50,000. It is claimed that 30% of the employees are getting salaries $\geq$Rs 2,50,000. Can this claim be true?

SOLUTION: Again consider the smallest possible numbers subject to the given conditions:
Even in this extreme low situation the average salary of all the employees is $0.30\times 250000 + 0.00 \times0=75000,$ which exceeds the stated average. So the claim cannot be true.

In fact, no more than $\frac 15$ of the employees can make 2,50,000 or more. Since 50000/250000 = $\frac 15$. ■

The same reasoning leads to the following very useful inequality.

Markov inequality Let $X$ be a nonnegative random variable. Let $\epsilon>0.$ Then $P(X \geq \epsilon) \leq \frac{E(X)}{\epsilon}.$

Proof: As in the examples above, we consider the "minimum possible version of $X$": $$Y = \left\{\begin{array}{ll} \epsilon&\text{if }X\geq \epsilon\\ 0&\text{otherwise.}\end{array}\right..$$ We must have $Y\leq X.$ Hence $E(Y)\leq E(X).$ But $E(Y) = P(X\geq \epsilon) \epsilon.$ Hence the result. [QED]

A point about the inequalities in the above theorem. There are two inequalities, one inside the probability, and one outside: $$P(X \geq \epsilon) \leq \frac{E(X)}{\epsilon}.$$ Both are mixed inequalities. Obviously, you may make the first inequality strict (thereby weakening the result). However, you may not replace the other inequality with a strict one, because otherwise you will get $1 < 0$ for the degenerate random variable $X\equiv0$.

The following variant of the Markov inequality is due to Chebyshev.
Chebyshev is also credited with designing a quadruped robot-like linkage.
Chebyshev inequality Let $V(X)<\infty.$ Then $$ \forall \epsilon>0~~P(|X-E(X)| \geq \epsilon) \leq \frac{V(X)}{\epsilon^2}. $$

Proof: Note that $P(|X-E(X)| \geq \epsilon) = P((X-E(X))^2 \geq \epsilon^2).$ Now apply Markov inequality to the random variable $(X-E(X))^2.$ [QED]

2.1. Problem set

EXERCISE 7: Give a counterexample to show that the nonnegativity assumption in the inequality may not be dropped.

EXERCISE 8: Let $X$ be any random variable (not necessarily nonnegative). Show that $$\forall \epsilon>0~~P(X\geq \epsilon) \leq \frac{E(X^2)}{\epsilon^2}.$$

EXERCISE 9: If you have solved the above exercise, you can also show that for any nonnegative random variable $X$ and any $\epsilon>0$ we have for each $k\in{\mathbb N},$ $$\forall \epsilon>0~~P(X\geq \epsilon) \leq \frac{E(X^k)}{\epsilon^k}.$$ Will higher values of $k$ necessarily give you better bounds?

EXERCISE 10: Prove that $\forall \epsilon>0~~\frac{1}{\sqrt{2\pi}}\int_{-\epsilon}^ \epsilon e^{-x^2/2}\, dx \geq \frac{\epsilon^2-1}{\epsilon^2}.$

3. Real life applications

Markov inequality is little more than commonsense, and naturally it finds many practical applications. Its greatest strength lies in the fact that it makes no assumption about the distribution of the the random variable other than through its expectation. For many real life random variables, estimating the expectation is far easier than estimating the entire distribution.

Let us start with an interesting application from computer science. A class of algorithms called Las Vegas algorithms, approach a problem in a random way that is sure to arrive at the answer, but after a random number of steps.

One example is the randomised quick sort algorithm:
Here we sort an array of numbers by picking a random element from the array, and dividing the rest into two groups, depending on whether a number is $\leq$ or $>$ than the picked element. Then we do the same thing recursively to both the groups separately, and stop when the entire array is sorted.

Let $X$ denote the number steps in a Las Vegas algorithm. We often know $E(X)$ as a function of the input size. For instance, in the randomised quicksort algorithm $E(X) = n\log n,$ where $n$ is the length of the array (proof not part of this course). Then Markov inequality helps us to get an upper bound on the probability that the algorithm will take too long. This allows engineers to guarantee system stability without knowing the exact distribution of $X.$

3.1. Problem set

EXERCISE 11: Let $X$ be the number of steps needed in a randomised quick sort algorithm. It is known that $E(X)=n\log n$ if the $n$ is the length of the array to be sorted. Find an upper bound for $P(X>10^6)$ if the input array has length $10^4.$

EXERCISE 12: (Router overload) A router receives a random number ($X$) of packets every millisecond. We know from the past that $E(X)=50.$ We do not know the distribution of $X.$ The router's buffer can hold 250 packets before overflowing. Help the network engineer to provide an uppr bound to the failure rate, $P(X\geq 250).$

EXERCISE 13: (Liquidity crisis) A bank has a large portfolio of small business loans. $X=$ number of defaulters in a single month. Past experience shows $E(X)=2M.$ Liquidity crisis will arise if $X\geq 20M.$ Bound the probability of that.

EXERCISE 14: (System downtime) A financial system tracks $X$ the downtime of the system per year. Past data shows $E(X)=15$ minutes. Crash would result if $X\geq 2$ hours. Bound its probability.

EXERCISE 15: (Volatile market) When the market is highly volatile market, an investment fund's historical data becomes useless. The only certain information is the current daily expected loss $E(X)=100,000.$ Upper bound $P(X\geq 1,000,000).$

EXERCISE 16:  (Primality testing) A randomised primality testing algorithm called the Miller Rabin test applies a random experiment on an input integer $n.$ The (random) output is either "Composite" or "Prime". There is theoretical guarantee that if it says "Composite", then the input is indeed composite. But if it says "Prime" then the input is composite with 0.25 probability.

Mathematically, let $$X = \left\{\begin{array}{ll}1&\text{if }\mbox{error}\\ 0&\text{otherwise.}\end{array}\right..$$ Then we have $E(X) = \frac 14.$ We run this experiment $k$ times independently (on the same input), and we output "Composite" if at least one run says so. Otherwise, we say "Prime".

Give an upper bound on the probability that this battery of $k$ tests makes an error. [This problem can also be solved without explicit use of Markov inequality.]

Project: Count-min sketch Imagine a stream of items going past you (like cars of different brands going down a road, or trees of different types as you walk through a forest). Each item belongs to one of a finite number of categories. The stream is running for a really long time (think of information packets passing through a busy computer connected to the internet). The number of categories is also huge (and not known beforehand). Your job is to keep track of the frequencies of the different categories you have seen so far. Tally marking is a very simple technique to achieve this. But if the number of categories is really huge, and most of them occur with negligible frequencies, tally marking is inefficient.

Here the count-min technique provides a more efficient approximate alternative.

So far as probability theory goes, it is a use of the Markov inequality. But before you get into the probability, you need to know about hash functions: functions that maps the huge set of categories to a much smaller set (whose elements we shall call buckets). Such functions may be constructed in a way that if $X_1,X_2,...$ are incoming categories and $h(\cdot)$ is the function, then $h(X_1), h(X_2),...$ behave like iid uniform random variables on the bucket set. Also, it is possible to construct different such functions $h_1,h_2,...$ such that the sequences generated from them behave like independent random variables. The functions, by the way, are themseleves deterministic, and are closely related to how a computer generates pseudo random numbers. Such functions are called hash functions.

While such a function cannot be one-one (it maps a finite set to a much smaller set), they are often used as quick-and-dirty versions of one-one functions (eg, checking integrity of downloaded files). This is the main idea behind the count-min algo, as well.

It is a project on the tougher side. The group may need to be large to distribute the work load.
Project: BJKST algorithm for counting distinct elements The set up is just like that for the last project. But here the aim is to estimate the number of unique categories seen so far (and not the frequency of any given category).

Here also you need to use hash functions. The difficulty level is comparable with the last project.