\documentclass[10pt,a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage[margin=2cm]{geometry}

\usepackage{enumitem}
\setenumerate[1]{label=\arabic*.}
\setenumerate[2]{label=(\alph*)}

% textcomp package is not available everywhere, and we only need the Copyright symbol
% taken from http://tex.stackexchange.com/a/1677/23992
\DeclareTextCommandDefault{\textregistered}{\textcircled{\check@mathfonts\fontsize\sf@size\z@\math@fontsfalse\selectfont R}}

\usepackage{fancyhdr}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\fancyhead{}
\fancyfoot[C]{Copyright {\textcopyright} 2015 Camil Staps}
\pagestyle{fancy}

\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{amssymb}
\newcommand*\diff{\mathop{}\!\mathrm{d}}
\newcommand{\Var}{\operatorname{Var}}
\DeclareMathAlphabet{\pazocal}{OMS}{zplm}{m}{n}

\usepackage{array}
\usepackage{caption}

\parindent0pt

\title{Calculus en Kansrekenen - assignment 7}
\author{Camil Staps\\\small{s4498062, group Bram}}

\begin{document}

\maketitle
\thispagestyle{fancy}

\begin{enumerate}
    \item \begin{enumerate}
            \item See Table \ref{tab:1a}.
                
                \begin{table}[h]
                    \centering
                    \setlength\extrarowheight{2pt}
                    \begin{tabular}{>{$}c<{$} *{7}{| >{$}c<{$}}}
                        X   & 0       & 1          & 2              & 3              & 4                & 5                 & 6\;(\uparrow)  \\\hline
                        P(X)& \frac25 & \frac6{25} & \frac{18}{125} & \frac{54}{625} & \frac{162}{3125} & \frac{486}{15625} & \frac{729}{15625}
                    \end{tabular}
                    \caption{}
                    \label{tab:1a}
                \end{table}

                I take $X$ as the number of bullets used \emph{before} hitting the target, i.e., not counting the bullet with which you hit the target.

                To hit the first time has a probability of $\frac25$. Then, for $1\le X\le 5$ we have $P(X) = (\frac35)^{X-1}\cdot\frac25$, because it is the probability that the shooter missed $X-1$ times times the probability that he hit a certain time. For $X=6$ I take that the shooter didn't hit at all. Strictly speaking, $X$ isn't defined in this case, which is why I write $6\;(\uparrow)$. The probability that this is the case is one minus the sum of the other probabilities.

            \item $E(X) = 0\cdot\frac25 + 1\cdot\frac6{25} + 2\cdot\frac{18}{125} + 3\cdot\frac{54}{625} + 4\cdot\frac{162}{3125} + 5\cdot\frac{486}{15625} + 6\cdot\frac{729}{15626} = \frac{22344}{15625} \approx 1.43$.

            \item \begin{align*}
                    \Var(X) =& \sum_i = P(X=x_i)(x_i-E(X))^2 \\
                            =&\; \tfrac25\left(0-\tfrac{22344}{15625}\right)^2 + \tfrac6{25}\left(1-\tfrac{22344}{15625}\right)^2 + \tfrac{18}{125}\left(2-\tfrac{22344}{15625}\right)^2 + \tfrac{54}{625}\left(3-\tfrac{22344}{15625}\right)^2 \\
                            &+ \tfrac{162}{3125}\left(4-\tfrac{22344}{15625}\right)^2 + \tfrac{486}{15625}\left(5-\tfrac{22344}{15625}\right)^2 + \tfrac{729}{15625}\left(6-\tfrac{22344}{15625}\right)^2 \\
                            =&\; \frac{692 214 414}{244 140 625} \approx 2.84
                \end{align*}

            \item $\sigma_X = \sqrt{\Var(X)} = \sqrt{\frac{692 214 414}{244 140 625}} = \frac{\sqrt{692 214 414}}{15625} \approx 1.68$.
        \end{enumerate}

    \item \begin{enumerate}
            \item First, we choose the five A will pass, with ${8\choose5}=56$ possibilities. This way, we count every possibility to reach $X_A=5$ exactly once. This has probability $\frac1{2^8}$ for some choice of the five assignments, because the first five have to be passed and the last three have to be failed. In total, that gives $P(X_A=5) = \frac{56}{2^8} = \frac7{32} \approx 0.219$.

            \item We divide this up and conquer the sub problems using the method from 2(a).
                \begin{align*}
                    P(X_A \ge 5) &= P(X_A=5) + P(X_A=6) + P(X_A=7) + P(X_A=8) \\
                        &= \frac{{8\choose5}}{2^8} + \frac{{8\choose6}}{2^8} + \frac{{8\choose7}}{2^8} + \frac{{8\choose8}}{2^8} \\
                        &= \frac{56 + 28 + 8 + 1}{2^8} = \tfrac{93}{256} \approx 0.363.
                \end{align*}

            \item This is similar, but we have to change the probabilities slightly:
                \begin{align*}
                    P(X_B \ge 5) &= P(X_B=5) + P(X_B=6) + P(X_B=7) + P(X_B=8) \\
                        &= \frac{{8\choose5}}{\tfrac54^5\tfrac51^3} + \frac{{8\choose6}}{\tfrac54^6\tfrac51^2} + \frac{{8\choose7}}{\tfrac54^7\tfrac51} + \frac{{8\choose8}}{\tfrac54^8} \\
                        &= \frac{56}{\tfrac{390625}{1024}} + \frac{28}{\tfrac{390625}{4096}} + \frac{8}{\tfrac{390625}{16384}} + \frac{1}{\tfrac{390625}{65536}} \\
                        &= \frac{73728}{78125} \approx 0.944.
                \end{align*}
        \end{enumerate}

    \item \begin{enumerate}
            \item This should satisfy $\int_{-\infty}^\infty f(x)\diff x = 1$. Since we know that $f(x)=0$ on $(-\infty,-\frac12] \cup [\frac12,\infty)$, that reduces to $\int_{-\frac12}^{\frac12} a(1-4x^2)\diff x = 1$. Hence we compute:
                \begin{align*}
                    \int_{-\tfrac12}^{\tfrac12} a-4ax^2 \diff x &= 1 \\
                    \left.ax - \tfrac43ax^3\right|_{-\tfrac12}^{\tfrac12} &= 1 \\
                    \left(\tfrac12a - \tfrac43a(\tfrac12)^3\right) - \left(-\tfrac12a - \tfrac43a(-\tfrac12)^3\right) &= 1 \\
                    a - \tfrac83a(\tfrac12)^3 &= 1 \\
                    a - \tfrac13a &= 1 \\
                    a &= 1\tfrac12.
                \end{align*}

            \item \begin{equation*}
                    F(x) = \begin{cases}
                        1\tfrac12x - 2x^3 + c & \mbox{if } -\tfrac12 < x < \tfrac12\mbox{,} \qquad\text{(as in 3(a), with $a=1\tfrac12$)} \\
                        c                     & \mbox{otherwise.}
                    \end{cases}
                \end{equation*}

            \item The probability that a continuous random variable has a certain value is $0$ (namely $\frac1\infty$).

            \item That would be
                \begin{align*}
                    \left.F(x)\right|_0^{\tfrac14} &= F(\tfrac14) - F(0) \\
                                                   &= 1\tfrac12\cdot\tfrac14 - 2\cdot(\tfrac14)^3 \\
                                                   &= \tfrac38 - \tfrac2{64} \\
                                                   &= \tfrac{11}{32}.
                \end{align*}
        \end{enumerate}

    \item \begin{enumerate}
            \item On $(-\infty,0)$ it is clear that $f(t)=0$. On $[0,\infty)$ we would have $f(t) = \frac\diff{\diff t} 1-e^{-kt} = -e^{-kt}\cdot-k = ke^{-kt}$. Therefore
                    \begin{equation*}
                        f(x) = \begin{cases}
                            0 & \mbox{if } t<0\mbox{,} \\
                            ke^{-kt} & \mbox{otherwise.}
                        \end{cases}
                    \end{equation*}

                \item \begin{align*}
                        E(T) &= \int_{-\infty}^\infty t\cdot f(t) \diff t \\
                             &= \int_0^\infty tke^{-kt} \diff t \\
                             &= \lim_{u\to\infty} \int_0^u tke^{-kt} \diff t \\
                             &= \lim_{u\to\infty} \left.-ke^{-kt}\right|_0^u \\
                             &= \lim_{u\to\infty} -ke^{-ku} + ke^{-k\cdot0} \\
                             &= \lim_{u\to\infty} k\left(1-e^{-ku}\right) \\
                             &\stackrel{(*)}{=} k.
                    \end{align*}

                    The last equation holds because $1-e^{-ku}=F(u)$, and $F$ is a cumulative distribution function, meaning its limit for $u\to\infty$ is $1$.

                    \begin{align*}
                        \Var(T) &= \int_{-\infty}^\infty (t-E(T))^2\cdot f(t) \diff t \\
                                &= 
                        %todo
                    \end{align*}
        \end{enumerate}

    \item %todo

\end{enumerate}

\end{document}

