Jekyll2018-08-27T08:45:38+00:00http://malikaliraza.com/blog/Prematurely OptimisedRandom derp about Maths, CS, and Philosophy.Ali MalikUsing Analysis in Set Theory2018-03-31T20:00:00+00:002018-03-31T20:00:00+00:00http://malikaliraza.com/blog/mathematics/2018/03/31/analysis-set-theory-natural-bijection<p>In a recent analysis class at Stanford, we learnt about the neat Riemann series theorem which states:</p>
<p><strong>Theorem 1.1 (Riemann Series Theorem)</strong>: If an infinite series is conditionally convergent, then you can
rearrange the terms in a permutation so that the new series converges to
any real number.</p>
<p>It is a fairly interesting result with a really cool proof! However, while messing around with it, I noticed it has a pretty interesting application in constructing injections between certain sets. In particular, it can be use to show that the set, $\mathcal{B}$ of bijections from $\mathbb{N}$ to $\mathbb{N}$ has the same cardinality as $2^\mathbb{N}$.</p>
<p><strong>Theorem 1.2</strong>: Let</p>
<script type="math/tex; mode=display">\mathcal{B} = \{f : f \text{ is a bijection from $\mathbb{N}$ to $\mathbb{N}$} \}.</script>
<p>Then $|\mathcal{B}| = 2^\mathbb{N}$. An interesting (interpretation) of this is that, $\mathbb{N}! = 2^{\mathbb{N}}$ since factorial is often defined in set theoretic terms as the set of bijection from a cardinal to itself.</p>
<p><em>Proof.</em> We will show $|\mathcal{B}| \leq 2^\mathbb{N}$ and $2^\mathbb{N} \leq |\mathcal{B}|$ and this will give us the result from the Cantor-Schroder-Bernstein Theorem.</p>
<p>The fact that $|\mathcal{B}| \leq 2^\mathbb{N}$ is obvious by the fact
that $|\mathcal{B}| \leq \mathbb{N}^\mathbb{N} = 2^\mathbb{N}$.</p>
<p>To show $2^\mathbb{N} \leq |\mathcal{B}|$, we construct an injection
from $\mathbb{R} \to \mathcal{B}$ (since $|\mathbb{R}| = 2^\mathbb{N}$).
This is where the neat analysis trick comes in. Take a series that
converges conditionally e.g.</p>
<script type="math/tex; mode=display">\sum_{n=0}^{\infty} x_n \qquad \text{ where } x_n = \frac{(-1)^n}{n+1}</script>
<p>Then by Riemann’s theorem, for any real number $r$, there is a
permutation/rearrangement $\pi : \mathbb{N} \to \mathbb{N}$ of the terms
$x_n$ such that $\sum_{n=0}^{\infty} x_{\pi(n)}$ converges to $r$. So
given a real $r$, we can injectively map it to the permutation of
$\mathbb{N}$ that causes the series to converge to $r$. Since a
perumation is equivalent to a bijection, this gives us the desired
injection and thus $2^\mathbb{N} = |\mathbb{R}| \leq |\mathcal{B}|$ as
required. So by CBS $|\mathcal{B}| = \mathbb{N}! = 2^\mathbb{N}$.</p>Ali MalikAn interesting application of a theorem from analysis in proving equal cardinality of two important sets.Warlords and Spies2018-03-30T20:00:00+00:002018-03-30T20:00:00+00:00http://malikaliraza.com/blog/mathematics/2018/03/30/warlords<h1 id="problem">Problem:</h1>
<p>(From Alex Sierra, via fivethirtyeight.com). There are two warlords: you
and your archenemy, with whom you’re competing to conquer castles and
collect the most victory points. Each of the $10$ castles has its own
strategic value for a would-be conqueror. Specifically, the castles are
worth $1, 2, 3 \dots , 9$ and $10$ victory points. You and your enemy
each have $100$ soldiers to distribute between any of the $10$ castles.
Whoever sends more soldiers to a given castle conquers that castle and
wins its victory points. If you each send the same number of troops,
you split the points. Whoever ends up with the most points wins.</p>
<p>But now, you have a spy! You know how many soldiers your archenemy will
send to each castle. The bad news, though, is that you no longer have
100 soldiers — your army suffered some losses in a previous battle.
What is the value of the spy? That is, given a spy who can inform you of
your enemy’s allocations, how many soldiers do you need to always be
able to win?</p>
<h1 id="solution">Solution:</h1>
<p><strong>Theorem</strong>: You need exactly $56$ soldiers to always be able to win, so the value of so the value of the spy is $44$.</p>
<p><em>Proof.</em></p>
<p>Let $b(i)$ be the number of soldiers the enemy sends to caste $i$. First
we show that you need at least 56 soldiers to always be able to win.
Consider the case where the enemy makes the following allocations:</p>
<script type="math/tex; mode=display">% <![CDATA[
\begin{aligned}
b(1) &= 1 \\
b(2) &= 3 \\
b(3) &= 5 \\
\vdots \\
b(10) &= 19 \\
\end{aligned} %]]></script>
<p>Then we need two soldiers per point we win and since we need at least $28$
i.e. half of $1 + 2 + \dots + 10$ points to win, this will require $56$
soldiers.</p>
<p>Now the task is to show that $56$ always works. That is, for any
allocation of the enemy’s $100$ soldiers, if we know the allocations, we should be
able to win with $56$ soldiers.</p>
<p>Suppose for the sake of contradiction that this were not the case. Then for any choice of castles
$a_1, \dots a_k$ that are sufficient to win the war i.e. $\sum_{i = 1}^k a_i \geq 28$, we must need more than 56 soldiers to win these castles. That is</p>
<script type="math/tex; mode=display">\sum_{i = 1}^k \left( b(i) + 1 \right) \geq 57</script>
<p>or in other words:</p>
<script type="math/tex; mode=display">\label{eq1}\tag{1}
\sum_{i = 1}^k b(i) \geq 57 - k.</script>
<p>With this, we can generate some bounds on each $b(i)$. First note that we
can assume $b(1) \leq b(2) \leq \dots \leq b(10)$ since any
configuration where $b(n) > b(n + i)$ is strictly easier to win than one where this is not the case. This is because it allows us to win a higher valued castle with less soldiers than it would take to win the lower valued one.</p>
<p>Now we can create bounds for $b(1)$. Using Equation
(\ref{eq1}) and castle combinations with high enough value, we have:</p>
<script type="math/tex; mode=display">% <![CDATA[
\begin{aligned}
b(1) + b(8) + b(9) + b(10) &\geq 53 \\
b(1) + b(2) + b(3) + \dots + b(7) &\geq 50 \\
\end{aligned} %]]></script>
<p>adding these together, we get</p>
<script type="math/tex; mode=display">% <![CDATA[
\begin{aligned}
b(1) + b(1) + b(2) +\dots+ b(10) &\geq 103 \\
b(1) + 100 &\geq 103 \\
b(1) &\geq 3 \\
\end{aligned} %]]></script>
<p>Already we are in a good place, since the warlord is forced to make a
seemingly suboptimal allocation—sending three soldiers to a low valued
castle. Now consider the following inequalities:</p>
<script type="math/tex; mode=display">% <![CDATA[
\begin{aligned}
b(2) + b(7) + b(9) + b(10) &\geq 53 \\
b(2) + b(3) + b(4) + \dots + b(6) + b(8) &\geq 51 \\
\end{aligned} %]]></script>
<p>which, when added, give</p>
<script type="math/tex; mode=display">% <![CDATA[
\begin{aligned}
b(2) - b(1) + b(1) + \dots + b(10) &\geq 104 \\
b(2) - b(1) + 100 &\geq 104 \\
b(2) &\geq b(1) + 4 \geq 7\\
\end{aligned} %]]></script>
<p>Similarly, for $b(3)$ we can look at</p>
<script type="math/tex; mode=display">% <![CDATA[
\begin{aligned}
b(3) + b(6) + b(9) + b(10) &\geq 53 \\
b(1) + b(3) + b(4) + b(5) + b(7) + b(8) &\geq 51 \\
\end{aligned} %]]></script>
<p>which, when added, gives</p>
<script type="math/tex; mode=display">% <![CDATA[
\begin{aligned}
b(3) - b(2) + b(1) + \dots + b(10) &\geq 104 \\
b(3) - b(2) + 100 &\geq 104 \\
b(3) &\geq b(2) + 4 \geq 11\\
\end{aligned} %]]></script>
<p>And lastly, for $b(4)$, we get</p>
<script type="math/tex; mode=display">% <![CDATA[
\begin{aligned}
b(4) + b(5) + b(9) + b(10) &\geq 53 \\
b(1) + b(2) + b(4) + b(6) + b(7) + b(8) &\geq 51 \\
\end{aligned} %]]></script>
<p>which gives</p>
<script type="math/tex; mode=display">% <![CDATA[
\begin{aligned}
b(4) &\geq b(3) + 4 \geq 15\\
\end{aligned} %]]></script>
<p>So we have,</p>
<script type="math/tex; mode=display">% <![CDATA[
\begin{aligned}
b(1) &\geq 3 \\
b(2) &\geq 7 \\
b(3) &\geq 11 \\
b(4) &\geq 15 \\
\end{aligned} %]]></script>
<p>and from our assuption that $b(1) \leq \dots \leq b(10)$, we have</p>
<script type="math/tex; mode=display">% <![CDATA[
\begin{aligned}
b(1) + b(2) + \dots + b(10) &\geq 3 + 7 + 11 + 15 \cdot 7 \\
&= 126
\end{aligned} %]]></script>
<p>which clearly contradicts the fact that $b(1) + \dots + b(10) = 100$.
Thus our assumption that there is some enemy allcoation for which we
cannot win with $56$ soldiers must be false. Therefore, we should
always be able to win with exactly $56$ soldiers and so the spy is worth $44$
soldiers.</p>Ali MalikA fun problem based on a fivethirtyeight riddler puzzle.