<?php require_once($_SERVER["DOCUMENT_ROOT"] . "/common/common.INC.PHP");

print_page_header();

?>
<p>A Variation is an <em>time-ordered</em> selection of k elements out of n.</p>
<h2>Variation with putting back</h2>
<p>I want to explain this in a computer-science way, although you could guess from the 01st chapter how it would look otherwise (and how looong it would be).</p>
<p>Let's say you have k bits to store an integer in. A bit draws its value out of a set S with n:=2 elements, let's call them 0 and 1 (you could call them &quot;foo&quot; and &quot;bar&quot; if you prefer). However it copies the value and puts the original element back.</p>
<table border="1">
<caption>Set of possibilities (n elements)</caption>
<tr><td>0</td><td>1</td></tr>
</table>
<hr/>
<table border="1">
<caption>Storage (k elements)</caption>
<tr><td>[ ]</td><td>[ ]</td><td>[ ]</td><td>[ ]</td><td>[ ]</td></tr>
</table>
<p>Then the smallest integer number M you just cannot represent anymore (without loss of precision) is:</p>
<div class="eq"><img alt="M:=n^{k}" class="eq" height="17" src="image/equation/M%3A%3Dn%5Ek" width="72"/></div>
<p>This is because you have a number of storage bins (bits) where you can put <em>a copy of</em> any element of your original set <img alt="\{0,1\}" class="ieq" height="20" src="image/equation/%7B0%2C1%7D" width="46"/>. Since you still have the original, at the next position, you again have all the elements to choose from, but one bin less to go.</p>
<p>If you do until all the bins are full, then the number of variations M (number of different ways to put items in the bins) you can have is:</p>
<div class="eq"><img alt="M=|S|⋅|S|⋅..." class="eq" height="20" src="image/equation/M%3D%7CS%7C%E2%8B%85%7CS%7C%E2%8B%85..." width="136"/></div>
<div class="eq important"><img alt="M=|S|^k" class="eq" height="22" src="image/equation/M%3D%7CS%7C%5Ek" width="78"/></div>
<div class="eq important"><img alt="M=n^k" class="eq" height="17" src="image/equation/M%3Dn%5Ek" width="67"/></div>
<p>For 3 bits (3 bins), the variations are: 000, 001, 010, 011, 100, 101, 110, 111. The count is 8, which is <img alt="2^3" class="ieq" height="16" src="image/equation/2%C2%B3" width="17"/>.</p>

<h2>Variation without putting back</h2>
<p>Now if you didn't copy the element of the set but instead just put it into the bin, then the number of possible elements would shrink after each step.</p>
<p>So similar to before:</p>
<div class="eq"><img alt="M:=|S|⋅(|S|-1)⋅..." class="eq" height="21" src="image/equation/M%3A%3D%7CS%7C%E2%8B%85%28%7CS%7C-1%29%E2%8B%85..." width="190"/></div>
<p>But now it depends on how many bins k you have. You could have less bins that there are elements in the set, too.</p>
<p>If you want to use the factorial you already know, you have a problem since the factors in the factorial goes down all the way to 1, but here we possibly stop before that.</p>
<p>So you use the factorial for the entire way down to 1 and then cancel out all the factors from the bottom you didn't want.</p>
<!-- <p>Let's say the set of elements is {0,1,2,3}.</p>
<p>But we have only two bins.</p>
<p>The bins could then contain: <del>00</del>, 01, 02, 03, 10, <del>11</del>, 12, 13, 20, 21, <del>22</del>, 23, 30, 31, 32, <del>33</del>. Number of variations: 12.</p>
<p>Notice how elements with 2 or more equal digits don't work.</p>
<p>So the variance M is:</p> -->
<div class="eq"><img alt="n:=|S|" class="eq" height="20" src="image/equation/n%3A%3D%7CS%7C" width="65"/></div>
<div class="eq important"><img alt="M=÷{n!}{(n-k)!}" class="eq" height="45" src="image/equation/M%3D%C3%B7%7Bn%21%7D%7B%28n-k%29%21%7D" width="116"/></div>
