% use [nosolutions] flag to hide solutions.
% use [solutions] flag to show solutions.
\documentclass[solutions]{../../resources/ormc_handout}

\newcommand{\nck}[2] {
	\ensuremath{
		{}_{#1}C_{#2}
	}
}

\newcommand{\npk}[2] {
	\ensuremath{
		{}_{#1}P_{#2}
	}
}


\begin{document}

	\maketitle
		<Intermediate 2>
		<ORMC Summer Sessions>
		{Combinatorics}
		{Prepared by Mark on \today}

	\section{Getting started}

	An ordered arrangement of objects is called a \textit{permutation}. An unordered selection\footnotemark of objects is called a \textit{combination}. All the following problems involve permutations.\\

	\footnotetext{A ``combination lock'' cares about the order of its digits, so its name is inaccurate. Such an object is actually a \textit{permutation} lock!}


	\problem{}<ABCDE>
	How many different ways are there to rearrange the letters ABCDE? \\

	\begin{solution}
		$5 \times 4 \times 3 \times 2 \times 1 = 120$
	\end{solution}

	\vfill

	\problem{}<AtoZ>
	How many different ways are there to arrange the letters ABCDEFG...XYZ? \\
	The answer is a \textit{very} big number. You should not fully resolve your answer. \\
	\hint{When you see a problem that's as big as this one, it's often wise to try and understand a simpler case first. Look at \ref{ABCDE} again, and try to create a general strategy.}


	\begin{instructornote}
		A hint for students that are stuck: \\
		In \ref{ABCDE}, start with five blank spaces. How many choices are there for A's position? \\
		Once A is placed, how many are left for B?
	\end{instructornote}

	\vfill
	\pagebreak

	\definition{}
	The \textit{factorial} of a positive integer $x$ is $x \times (x-1) \times ... \times 1$. We denote this $x!$. \\
	For example, $8! = 8 \times 7 \times 6 \times 5 \times 4 \times 3 \times 2 \times 1 = 40320$.

	\problem{}
	Compute $\frac{10!}{8!}$
	\vfill

	\problem{}
	Convince yourself that $(n+1)! = n! \times (n+1)$, and use this fact to show that $0! = 1$.
	\vfill

	\problem{}
	How many ways are there to choose three student council officers from a class of 20 students? \\
	How many ways are there to choose a president, a vice-president, and a treasurer from the same class? \\
	\hint{You answers should be different. In which case does order matter?}

	\begin{instructornote}
		Have your students consider the non-unique arrangements and count how many are redundant.
	\end{instructornote}

	\vfill
	\pagebreak

	\problem{}
	Say you have 4 red balls and 3 green balls. How many different ways can you arrange them on the table in font of you? \\

	\begin{solution}
		Consider the sequence RRRRGGG. There are $4!$ ways to rearrange the red balls, and $3!$ ways to rearrange the green balls. This is true for any sequence. \\

		So, our solution is $\frac{7!}{3!4!}$.
	\end{solution}

	\vfill

	\problem{}
	How many \textit{unique} anagrams can we create from the word CRESCENDO?


	\begin{solution}
		CRESCENDO = CC EE RSNDO, our solution is $\frac{9!}{2!2!} = 90720$
	\end{solution}
	\vfill

	\problem{}<3fromABCDE>
	Given the letters ABCDE, how many different three-letter words can we make without repeating letters?
	\vfill
	\pagebreak

	\section{Permutations}

	It would be convenient to have a general tool for counting permutations. Let us try to create one. \\
	(Remember, permutations are \textit{ordered} arrangements of objects.)

	First, let's create a function $\npk{n}{k}$, which tells us how many $k$-object permutations we can choose from a group of $n$ objects.

	\problem{}
	What is $\npk{5}{3}$? \\
	\hint{See \ref{3fromABCDE}}


	\vfill
	``Choosing $k$ items from $n$'' is a lot like splitting our $n$ objects into two groups: those we choose, and those we don't. \\

	\begin{center}
		\begin{tikzpicture}
			% Points
			\path [draw=black, fill=black] (0,0) circle (5pt);
			\path [draw=black, fill=black] (1,0) circle (5pt);
			\path [draw=black, fill=white] (2,0) circle (5pt);

			% "Choose these" bracket
			\draw[shift={(-0.5, -1)}, color=orange, thick] (0pt,0pt) -- (0pt,3pt);
			\draw[color=orange, thick] (-0.5, -1) -- (2.5, -1) node[below, midway] {Choose $k$ objects};
			\draw[shift={(2.5, -1)}, color=orange, thick] (0pt,0pt) -- (0pt,3pt);


			\draw[-] (3, -0.5) -- (3, 0.5);

			\path [draw=black, fill=white] (4,0) circle (5pt);
			\path [draw=black, fill=black] (5,0) circle (5pt);

			% "Leave these" bracket
			\draw[shift={(3.5, -1)}, color=orange, thick] (0pt,0pt) -- (0pt,3pt);
			\draw[color=orange, thick] (3.5, -1) -- (5.5, -1) node[below, midway] {Leave the rest};
			\draw[shift={(5.5, -1)}, color=orange, thick] (0pt,0pt) -- (0pt,3pt);
		\end{tikzpicture}
	\end{center}

	If we rearrange these, we get different permutations. How can we count them?

	\problem{}<nPk>
	Using the above diagram, create a formula for $\npk{n}{k}$. \\
	\hint{We're counting \textit{permutations}, so the order of items in the first group matters.}

	\begin{solution}
		$\npk{n}{k}= \frac{n!}{(n-k)!}$

		There are $n!$ possible arrangements of $n$ objects. However, since the order of the elements not chosen does not matter, we'll end up with $(n-k)!$ redundant orderings of each.
	\end{solution}


	\vfill
	\pagebreak

	\section{Combinations}

	Now, let's count \textit{combinations}. \\
	Here, we care about \textit{which} items we choose, but not \textit{how} we choose them. We'll make a function $\nck{n}{k}$, or \textit{``n choose k''}. This will tell us how many different ways we can choose $k$ items from a set of $n$.

	\problem{}
	Find an expression for $\nck{n}{k}$ by modifying your definition of $\npk{n}{k}$.


	\vfill

	Usually, $\nck{n}{k}$ is written as $\binom{n}{k}$. This is also called the \textit{binomial coefficient}.

	\section{Applications}

	\problem{}
	Use the meaning of \nck{n}{k} to explain why $\nck{n}{k} = \nck{n}{n - k}$

	\vfill

	\problem{}
	Use the formula of $\nck{n}{k}$ to explain why $\nck{n}{k} = \nck{n}{n - k}$

	\vfill

	\problem{}
	How many ways can a class of 27 people be seated in 30 seats?

	\vfill
	\pagebreak


	\problem{}
	The following is the map of a city. Each line is a one-way road, you can only drive up or right. \\
	How many different paths can you take from A to B? \\
	How many of them go through the center point? \\

	\begin{tikzpicture}
		\draw [step=0.5,gray] (0,0) grid (7*0.5,4*0.5);

		\path [draw=black, fill=black] (0 * 0.5, 0 * 0.5) circle (2pt) node[below] {A};
		\path [draw=black, fill=black] (3 * 0.5, 2 * 0.5) circle (2pt);
		\path [draw=black, fill=black] (7 * 0.5, 4 * 0.5) circle (2pt) node[above] {B};
	\end{tikzpicture}

	\vfill

	\problem{}
	How many ways can you put 19 identical balls into 6 bins, so that no bin is empty?

	\vfill

	\problem{}
	Given an exam with 4 problems, how many ways are there to assign positive point values to each problem so that the exam contains a total of 100 points?

	\vfill

	\problem{}
	How many ways can we split the number 2016 into a sum of positive integers?

	\vfill

	\problem{}
	A staircase must be built up a wall. It will start 4.5 meters away from the wall, which is 1.5 meters tall. The height of each step is exactly 30 centimeters. The width of each step must be an integer multiple of 50 centimeters. In how many ways can the staircase be constructed?

	\vfill
	\pagebreak

	\section{Bonus problems}

	\problem{}
	A toy consists of a ring with 3 red beads and 7 blue beads on it. If two configurations of beads differ only by rotations and reflections, they are considered the same toy. How many different toys are there?

	\vfill

	\problem{}
	At a math circle meeting, 10 students are given 10 problems. Any two students solved a different number of problems, and every problem is solved by the same number of students. Yan solved problems 1 through 5, but did not solve problems 6 through 9. Did he solve problem 10?

	\vfill

	\problem{}
	A stressed-out student consumes at least one espresso every day of a particular year, drinking $500$ overall. Prove that on some consecutive sequence of whole days the student drinks exactly $100$ espressos.
	\note<Warning>{This problem is significantly harder than anything else in the handout.}

	\vfill

\end{document}
