When k = (n + 1)/2 (assuming n is odd), then we have Randomized Median-Select algorithm.
Randomized Algorithm: Monte Carlo
Randomized Matrix-Multiplication Checking
Freivalds' Matrix Multiplication Checking Algorithm: checking A \cdot B =^? C.
Choose random vector \vec{r} = \langle{r_1, r_2, ..., r_n}\rangle where r_i \in \{0, 1\}.
if A(B\vec{r}) \neq C\vec{r} return False, else return True
Theorem: for A \cdot B \neq C, the error probability is:
Pr\{A \cdot B \cdot \vec{r} = C \cdot \vec{r}\} \leq \frac{1}{2}
If we chose \vec{r} such that A \cdot B \cdot \vec{r} \neq C \cdot \vec{r} when it is really A \cdot B \neq C, then we say \vec{r} witness the fact A \cdot B \neq C.
Proof: given D := AB - C \neq 0, what is the probability D\vec{r} = AB\vec{r} - C\vec{r} = \vec{0}? Well, since D \neq 0, let d_{1, 1} be the non-zero entry of D.
If we want to pass the test by maliciously choosing r, r_1 is determined when r_2, r_3, ..., r_n is determined. Therefore, for every set of r_2, r_3, ..., r_n, there is one r_1 that makes the malicious injection successful. Since r_1 \in \{0, 1\}, the probability such that our choice r_1 magically equal to -\frac{1}{d_{1, 1}} \sum_{j = 2}^n (d_{1, j} r_j) is \leq \frac{1}{|\{0, 1\}|}.
Note the \leq is used above. We could have the case that none of our choice will make us pass the test due to the chance that -\frac{1}{d_{1, 1}} \sum_{j = 2}^n (d_{1, j} r_j) \not\in \{0, 1\}.
The algorithm is \in \Theta(n^2). We can boost it by running k times with complexity \in \Theta(kn^2) to achieve error rate \leq \left(\frac{1}{|\{0, 1\}|}\right)^k. We can also boost it by choosing \vec{r} \in \{0, 1, 2\}^n rather than \vec{r} \in \{0, 1\}^n.
What is some of our choice of random vector \vec{r} repeat in our process of boosting? This turns out is not a problem as long as we choose vectors independently. What if we have an algorithm with 2-sided error? Then we can do majority voting.
Randomized Polynomial Checking
We would like to know if a given polynomial G(x) := x^3 - x^2 - 41x +105 is equal to G(X) := (x - 3)(x - 5)(x + 7) without simplifying them (as it is expensive \in O(d^2)).
Let d be the number of root (degree) of polynomial.
Simple Random Checker:
pick a random value r out of n \cdot d many possible choices
if F(r) = G(r) return True, otherwise return False.
The above algorithm is \in \Theta(d)
Proof: Let H(x) = F(x) - G(x), observe H(x) has at most d roots.
Given F(x) \neq G(x):
\begin{align*}
&Pr\{F(r) = G(r)\}\\
=& Pr\{H(r) = 0\}\\
\leq& \frac{d}{nd} \tag{$\leq d$ many values in choices for $r$ that satisfy}\\
=& \frac{1}{n}\\
\end{align*}
Note the \leq is used above. We could have the case that none of our choice are roots to H(x).
Again, we can boost it to achieve error rate \leq \frac{1}{n^k} by running it k times with complexity \Theta(kd).
Randomized Min-Cut
Cut-set: a set of edges whose removal will break the graph into two or more connected components.
The algorithm: given graph G = \langle{E, V}\rangle. Let |V| = n, C be the set of edges represent one of those min-cuts and |C| = k.
For each iteration, contract two vertice by selecting a random common edge e \in E between v_1, v_2.
Stop until there is only two vertice left
Since there is n vertice, we need n - 2 iterations. We know the graph has at least \frac{nk}{2} edges by edge counting since k is the length of smallest cut set.
Let E_i denotes the event "no edge of C is selected in the i-th round". We calculate E_1:
Therefore the probability that the algorithm doesn't output a specific min-cut is: \leq 1 - \frac{2}{n(n - 1)}. It is less than a high probability. (It is unlikely it will produce min-cut)