\documentclass[12pt,a4paper]{article}
\usepackage{times,amsmath,graphicx,xcolor,color,psfrag,verbatim}

\newcommand{\Mini}{\texttt{Minitab }}
\newcommand{\one}{\scriptsize$\vert$}
\newcommand{\two}{\scriptsize$\vert\vert$}
\newcommand{\three}{\scriptsize$\vert\vert\vert$}
\newcommand{\four}{\scriptsize$\vert\vert\vert\vert$}
\newcommand{\five}{\scriptsize$\vert\vert\vert\vert\hspace*{-3.7mm}\text{-----}$~~}

\newcommand{\cc}[1]{\texttt{#1}}
\newcommand{\ca}{\ensuremath{\rightarrow}\ }
\newcommand{\comb}[2]{\,^{#1}\text{C}_{#2}}

\topmargin=-2.0cm
\textheight=25.2cm
\oddsidemargin=-1.0cm
\textwidth=17.5cm

\parindent 0cm

\parskip 0.4cm

\begin{document}

\begin{center}
\bfseries
\large
ACC1012/3: Professional Skills for Accounting and Finance

%\Large

%\textcolor{red}{\bf This document will be updated every week!}

\LARGE
Solutions to practice questions: Chapter 1

\end{center}



\normalsize
\begin{itemize}
\item [\textbf{1.}] 
\begin{itemize}
\item [(a)] $m=2$ and $c=5$.
\item [(b)] $m=-2$ and $c=12$.
\item [(c)] Dividing throughout by 8 gives $y=\frac{1}{4}x+2$, and so $m=\frac{1}{4}$ and $c=2$.
\item [(d)] $m=1$ and $c=0$. 
\end{itemize}

\item [\textbf{2.}] Order of ``steepness'': Lines (a) and (b), then line (d), then line (c).  


\item [\textbf{3.}] 

%\begin{center}
\includegraphics[angle=-90]{sol1.1.ps}
%\end{center}

\vspace{-2cm}

\item [\textbf{4.}] 
\begin{itemize}
\item [(a)] $m=0.06$ and $c=7.44$.  
\item [(b)] For Natasha we have $x=450$, giving
\[
y=0.06\times 450 + 7.44 = 34.44,
\]
or 35 days.  
\item [(c)] For Holly we have $y=10$ giving
\begin{eqnarray*}
10 &=& 0.06x + 7.44 \\
10-7.44 &=& 0.06x \\
2.56 &=& 0.06x.
\end{eqnarray*}
Dividing by 0.06 gives $x=\pounds 42.67$.  
\end{itemize}

\item [\textbf{5.}] The width of Rocky's bedroom is $x$ metres and so the length is $3x$ metres.  
\begin{itemize}
\item [(a)] The perimeter $P$ is given by
\[
P = 3x+3x+x+x = 8x.
\]
\item [(b)] The area $A$ is given by
\[
A = 3x \times x = 3x^2.
\]
\item [(c)] Only the expression for $P$ is linear -- the expression for $A$ includes a term in $x^{2}$.  
\end{itemize}

\item [\textbf{6.}]
\begin{itemize}
\item [(a)] We are told that if a person is not given any of the hangover medicine at all, then we can expect a hangover to last for 10 hours.  Thus the $y$--intercept must be $c=10$, as this corresponds to the point with co--ordinates $(0,10)$.  Also, $(50,2)$ lies on the line, giving
\[
\textrm{Gradient} = \frac{\textrm{Change in $y$}}{\textrm{Change in $x$}} = \frac{10-2}{0-50} = \frac{8}{-50} = -0.16.
\]
So the linear function is $y=-0.16x +10$.  
\item [(b)] The optimal dose would cure the hangover after zero hours, i.e. at the point $y=0$, giving
\begin{eqnarray*}
0&=&-0.16x + 10   \\
%0-10 &=&-0.16 \\
-10  &=&-0.16x \\
  & & \\
    x &=&\frac{-10}{-0.16} = 62.5\textrm{mg}.
\end{eqnarray*}
\end{itemize}

\item [\textbf{7.}]  
\begin{itemize}
\item [(a)] Let $x$ be the number of minutes and $y$ be total cost.  Then we have
\[
y = 0.16x + 30.
\]
\item [(b)] If we make 3.5 hours worth of calls, then $x=3.5\times 60 = 210$, giving
\[
y = 0.16 \times 210+30 = \pounds 63.60.  
\]
\item [(c)] Let $z$ be the number of gigabytes used.  Then we have
\[
y = 0.05x+0.5z + 25.
\]
\end{itemize}

%\newpage

\item [\textbf{8.}]
\begin{itemize}
\item [(a)] $c=400$.
\item [(b)] The line passes through $(10,700)$ and $(20,1000)$; thus
\[
\textrm{Gradient} = \frac{\textrm{Change in $y$}}{\textrm{Change in $x$}} = \frac{1000-700}{20-10} = \frac{300}{10} = 30.  
\]
\item [(c)] The linear cost function is thus
\[
y=30x + 400
\]
\item [(d)] The intercept represents fixed costs of \pounds 400; the gradient represents the individual cost per part of \pounds 30.  
\item [(e)] If $x=24$, we have
\[
y = 30\times 24 + 400 = \pounds 1120.
\]
\end{itemize}

\item [\textbf{9.}] 
\begin{itemize}
\item [(a)] Linear, as highest power of $x$ is 1. 
\item [(b)] Linear, as highest power of $x$ is 1.  
\item [(c)] Expanding the brackets gives $14x-28 = 154$, so this is also linear (highest power of $x$ is 1). 
\item [(d)] When the brackets are expanded, we get $12x - 6x^{2} = -90$; since the highest power of $x$ is $>1$, this equation is \textit{not} linear in $x$ (in fact, we have a quadratic here).
\item [(e)] Cross--multiplying and then collecting like terms, we get
\begin{eqnarray*}
23(3x-2)  &=& -8\left(-2(4x-1)\right)\\
69x - 46  &=& -8\left(-8x+2\right)\\
69x - 46  &=& 64x-16 \\
69x - 64x &=&-16+46 \\
   5x     &=&30,
\end{eqnarray*}
which is linear since the highest power of $x$ is 1.
\item [(f)] Cross--multiplying and then simplifying, we get
\begin{eqnarray*}
10x^{2}+30   &=& 5x(2x+3) \\
10x^{2}+30    &=& 10x^{2}+15x \\
10x^{2}-10x^{2}+30 &=& 15x \\
                 30 &=&15x,
\end{eqnarray*}
which is linear; the quadratic term in $x$ has vanished, and the highest power of $x$ is 1.  
\end{itemize}

\item [\textbf{10.}] 
\begin{itemize}
\item [(a)] Subtracting 7 gives
\[
5x = 20,
\]
and so $x=4$.
\item [(b)] Adding 9 gives
\[
3x = -12,
\]
and so $x=-4$.  
\item [(c)] After expanding the brackets we get
\[
14x-28 = 154.
\] 
Adding 28 gives
\[
14x = 182,
\]
and so $x=13$.
\item [(d)] This equation is not linear.

\item [(e)] From question 1, you should see that we get 
\[
5x=30,
\]
giving $x=6$.
\item [(f)] From question 1, you should see that we get
\[
15x = 30,
\]
giving $x=2$.  
\end{itemize}

\item [\textbf{11.}] 
\begin{itemize}
\item [(a)] For his first 38 hours, Matty will earn \pounds $38x$.  For the remaining 10 hours, he will get double pay, that is $2 \times \textrm{\pounds}10 x$ = \pounds $20x$.  Thus, we have
\begin{eqnarray*}
38x + 20x  &=& 812, \qquad \textrm{i.e.} \\
58x        &=&812.
\end{eqnarray*}
\item [(b)] Dividing by 58, we see that $x=14$; that is, Matty's regular hourly wage is \pounds 14 per hour.  
\end{itemize}

\item [\textbf{12.}]  The linear equation for profit can be simplified:
\begin{eqnarray*}
\textrm{Profit}  &=& \textrm{total income} - \textrm{overheads} \\
                 &=& 6(x-2000) - \textrm{overheads} \\
                 &=&6x - (12000+\textrm{overheads}).
\end{eqnarray*}
Substituting $\textrm{Profit}=188000$ and $\textrm{overheads} = 10000$ and solving for $x$:
\begin{eqnarray*}
188000 &=&6x-(12000+10000)\\
188000 &=& 6x-22000 \\
188000+22000 &=& 6x  \\
210000       &=&6x \qquad \textrm{i.e.} \\
           x&=&35000,
\end{eqnarray*}
so \textit{Wang Enterprises} spent \pounds 35,000 on advertising.  

\item [\textbf{13.}] 
\begin{itemize}
\item [(a)] We use the gradient--point method.  We know that
\[
y=-0.75x + c,
\]
so we use the fact that the line passes through $(-6,1)$ to find $c$:
\begin{eqnarray*}
1 &=& -0.75 \times -6 + c \\
1 &=&4.5 + c \\
1-4.5 &=& c  \\ 
    c&=& -3.5.
\end{eqnarray*}
Thus, the line has equation $y=-0.75x - 3.5$.  
\item [(b)] Here, we use the point--point method.  The gradient is given by
\[
\textrm{Gradient} = \frac{\textrm{Change in $y$}}{\textrm{Change in $x$}} = \frac{38-11}{5-2} = \frac{27}{3} = 9,
\]
giving $y=9x+c$.  The line passes through $(2,11)$, and so to find $c$:
\begin{eqnarray*}
11  &=&9\times 2 + c \\
11 &=&18 + c \qquad \textrm{i.e.}\\
  c&=&11-18 \\
  c &=& -7.
\end{eqnarray*}
So the line has equation $y=9x-7$.  
\end{itemize}


\item [\textbf{14.}] 
\begin{itemize}
\item [(a)] The gradient is positive, and so we have a \textit{direct} or \textit{positive} relationship between $t$ and $p$; that is, the longer the time from the start of the film the product appears, the greater the proportion of viewers that will be able to recall the brand.  This might make sense -- it will probably be easier to recall the brand if it appeared towards the end of the film.
\item [(b)]  Here, we have $p=105/120 = 0.875$; solving for $t$, we get
\begin{eqnarray*}
-0.06+0.01t &=& 0.875 \\
      0.01t &=& 0.875+0.06 \\
        0.01t&=&0.935 \\
    & & \\
            t &=& \frac{0.935}{0.01} = 93.5,
\end{eqnarray*}
or 93.5 minutes into the film.  
\item [(c)] Such linear models might be flawed because $p$ is a proportion and  must lie between 0 and 1; there will be a set of values for $t$ for which $p$ will not lie in this region.  
\end{itemize}

\item [\textbf{15.}] Throughout this question, we will make use of the linear cost function
\[
y = mx + c,
\]
where $y=\textrm{overall costs}$, $m=\textrm{cost of individual circuitboard}$, $x=\textrm{number of circuitboards produced}$ and $c=\textrm{fixed costs}$.  
\begin{itemize}
\item [(a)] Here, we are told that $m=20$; we are also told that the linear cost function passes through the point $x=50$ and $y=1150$, and so we use the gradient--point method.  We have
\[
y = 20x+c;
\]
substituting $x=50$ and $y=1150$ gives
\begin{eqnarray*}
1150   &=& 20\times 50 + c \\
1150   &=&1000 + c \qquad \textrm{and so} \\
c     &=&1150-1000 = 150.
\end{eqnarray*}
So the linear cost function for televisions is $y=20x+150$, where fixed costs per batch are \pounds $150$.
\item [(b)] Here, we are told that for one batch $x=120$ and $y=3040$; for another batch we are told that $x=175$ and $y=4250$.  Thus, we use the point--point method here.  The gradient is given by
\[
\textrm{Gradient} = \frac{\textrm{Change in $y$}}{\textrm{Change in $x$}} = \frac{4250 - 3040}{175-120} = \frac{1210}{55} = 22,
\]
and so we have $y=22x+c$. Substituting $x=120$ and $y=3040$ gives
\begin{eqnarray*}
3040   &=& 22\times 120 + c \\
3040   &=&2640 + c \qquad \textrm{that is} \\
     c &=& 3040-2640 = 400,
\end{eqnarray*}
giving $y=22x+400$, where fixed costs per batch are \pounds $400$.  
\end{itemize}

\item [\textbf{16.}]
In the first pair, we choose to eliminate $x$ since the $x$--coefficients are the same.  Subtracting gives
\[
2y = 4
\]
and so $y=2$.  Substituting $y=2$ into the first equation gives
\begin{eqnarray*}
2x + 3 \times 2   &=& 18 \\
       2x         &=&18-6 \\
            2x    &=&12
\end{eqnarray*}
and so $x=6$.  
\\
\\
For the second pair, we can multiply the first equation by 3 and the second by 5 to give:
\begin{eqnarray}
12x + 15y  &= &195  \\
15x  - 15y &=& -60.
\end{eqnarray}
Notice that now the $y$--coefficients are the same (ignoring the sign).  Since we have $+15$ and $-15$, adding equations (1) and (2) above will eliminate the $y$'s, giving:
\[
27x = 135,
\]
and so $x=5$.  Substituting $x=5$ into (1) gives
\begin{eqnarray*}
60 + 15y  &=& 195 \\
     15y  &=&195-60 \\
      15y &=&135,
\end{eqnarray*}
and so $y=9$.  
\\
\\
For the third pair, multiplying the first equation by 2 and the second by 3 gives 
\begin{eqnarray}
12p+6q  &=&216 \\
12p + 21q  &=& 366.
\end{eqnarray}
Subtracting (3) from (4) gives
\[
15q  = 150,
\]
and so $q=10$.  Substituting $q=10$ into (3) gives
\begin{eqnarray*}
12p + 60 &=& 216 \\
    12p  &=&216-60 \\
     12p &=&156,
\end{eqnarray*}
and so $p=13$.  
\\
\\
The first thing we should do with the fourth pair of equations is collect like terms, giving:
\begin{eqnarray}
6A-3B  &=& 20 \\
5A-3B  &=&11
\end{eqnarray}
We will eliminate the $B$'s as their coefficients are the same.  Notice that the signs are the same too, and so we subtract (6) from (5), giving
\[
A = 9.
\]
Substituting $A=9$ into (5) gives
\begin{eqnarray*}
6\times 9 - 3B &=&20 \\
   54 - 3B     &=&20 \\
         -3B   &=&20-54 \\
           -3B &=&-34 \\
             B  &=& \frac{-34}{-3} = 11\frac{1}{3}.
\end{eqnarray*}

\item[\textbf{17.}] Drawing up a table might help:
\begin{center}
\begin{tabular}{|c| c c |} \hline
              &Balloons    &Sweets   \\ \hline 
Ghastly ($x$) &10          &64       \\
Devilish ($y$)&20          &16      \\ \hline
Total         &3000        &8000    \\ \hline
\end{tabular}
\end{center}

Thus, we have 
\begin{eqnarray}
10x + 20y  &=& 3000 \\
64x + 16y  &=& 8000.
\end{eqnarray}
\begin{itemize}
\item [(a)] We can simplify the simultaneous equations.  For example, dividing (7) by 10, and dividing (8) by 8, we get:
\begin{eqnarray}
x + 2y &=& 300 \qquad \textrm{and} \\
8x +2y &=& 1000.
\end{eqnarray}
Now subtracting (9) from (10) eliminates the $y$'s and gives
\[
7x = 700,
\]
and so $x=100$.  Substituting $x=100$ into equation (9) gives
\begin{eqnarray*}
100 + 2y &=& 300 \\
      2y &=&300-100 \\
      2y &=& 200,
\end{eqnarray*}
and so $x=100$.  So the company can make 100 packs of both the ``Ghastly'' and ``Devilish'' variety.  You should be able to see the same solution on a graph. 
\item [(b)] Total profit will be given by
\begin{eqnarray*}
P &=& 1.2x + 1.8y \\
  &=&  1.2\times 100 + 1.8\times 100 \\
  &=& \pounds 300.
\end{eqnarray*}
\end{itemize}


\item [\textbf{18.}] 
\begin{itemize}
\item [(a)] Formulation of the linear programming problem:

\vspace{0.5cm}

\textbf{Step 1: Decision variables}
\begin{eqnarray*}
x  &=& \textrm{no. of bears to make} \\
y  &=& \textrm{no. of cats to make}
\end{eqnarray*}

\vspace{0.5cm}

\textbf{Step 2: Constraints} \\
Extending the table given in the question, we have:
\begin{center}
\begin{tabular}{|c|c c |c|} \hline
              &Material ($\textrm{m}^{2}$)     &Time (mins) &Profit (pence) \\ \hline
Bear          &5                               &12          &150     \\
Cat           &8                               &8           &175  \\ \hline
Limits        &2000                            &2880        &    \\ \hline
\end{tabular}
\end{center}
This gives:
\begin{eqnarray*}
\textrm{Material:} && 5x  + 8y \leq 2000 \\
\textrm{Time:}    && 12x + 8y  \leq 2880  
\end{eqnarray*}
We also have the non--negativity constraints:
\begin{eqnarray*}
        x&\geq& 0 \qquad \textrm{and} \\
        y&\geq& 0.
\end{eqnarray*}

\vspace{0.5cm}

\textbf{Step 3: Objective function}\\
The objective is to maximise profit $P$, where
\[
P = 150x+175y \textrm{ pence.}
\]

\vspace{0.5cm}

In summary, we have the following problem:
\\
\\
Maximise $P=150x+175y$ subject to the following constraints:
\begin{eqnarray*}
5x+8y &\leq& 2000 \\
12x+8y &\leq& 2880 \\
x   &\geq &0 \\
y   &\geq& 0.
\end{eqnarray*}

\newpage

\item [(b)] For the graph (see overleaf), we plot the \textit{equations} of the above inequalities and then shade out the unwanted regions.  
\\
\\
{\color{blue}
For $5x+8y=2000$:
\begin{itemize}
\item [--]When $x=0$, $8y=2000 \rightarrow y=250$, giving the point $(0,250)$
\item [--]When $y=0$, $5x=2000 \rightarrow x=400$, giving the point $(400,0)$
\end{itemize}}

\vspace{0.3cm}

{\color{red}
For $12x+8y =2880$:
\begin{itemize}
\item [--]When $x=0$, $8y=2880 \rightarrow y=360$, giving the point $(0,360)$
\item [--]When $y=0$, $12x=2880 \rightarrow x=240$, giving the point $(240,0)$
\end{itemize}
}

\vspace{0.3cm}

{\color{brown}
For the profit line $P=150x+175y$ we need a starting value for $P$.  Using $P=150\times 175 = 26250$:
\begin{itemize}
\item [--]When $x=0$, $175y = 26250 \rightarrow y=150$, giving the point $(0,150)$
\item [--]When $y=0$, $150x = 26250 \rightarrow x=175$, giving the point $(175,0)$
\end{itemize}}
\vspace{0.3cm}
Plotting these, and shading accordingly, gives the graph shown overleaf.

\vspace{0.5cm}

\item [(c)] From the diagram, you should see that profit will be maximised at the intersection of the two lines $5x+8y=2000$ and $12x+8y=2880$.  At this point, we have $x\approx 126$ and $y\approx 171$, giving
\[
P = 150\times 126 + 171 \times 175 = 48825 \textrm{ pence},
\]
that is, making 126 bears and 171 cats will maximise profits, giving \pounds 488.25 per day.  
\vspace{0.5cm}
\item [(d)] Algebraic solution (eliminate the $y$'s by subtraction):
\begin{eqnarray*}
5x+8y &=&2000 \\
\underline{12x+8y}&=& \underline{2880} \\
7x    &=&880
\end{eqnarray*}
giving $x=125.714$.  Substituting $x=125.714$ back into one of the equations and solving for $y$ gives $y=171.429$.  Now $x$ and $y$ must be integers, and we must remain inside the feasible region, and so we need to consider all pairs $(125,171)$, $(125,172)$, $(126,171)$, $(126,172)$.  Let us take $x=125$; then, according to the constraint on material,
\begin{eqnarray*}
5x + 8y &\leq& 2000 \\
5 \times 125 + 8y &\leq&2000 \\
625 + 8y             &\leq& 2000 \\
                  8y &\leq&1375 \qquad \textrm{and so} \\
                     y &\leq& 171.875.
\end{eqnarray*}
Also, according to the constraint on time, 
\begin{eqnarray*}
12x+8y  &\leq& 2880 \\
  12\times 125 + 8y &\leq& 2880 \\
1500             + 8y &\leq& 2880 \\
                        8y &\leq& 1380 \qquad \textrm{and so} \\
                           y &\leq& 172.5.
\end{eqnarray*}
To satisfy \textit{both} $y\leq 171.875$ and $y\leq 172.5$, $y\leq 171.875$, i.e. $y\leq 171$ for integer values of $y$.  So $x=125$ and $y=171$ is a possible solution, giving $\pounds 486.75$ profit.    
\\
\\
Let us now take $x=126$.  Working through the constraint on material, we have
\begin{eqnarray*}
5 \times 126 + 8y &\leq& 2000\\
630 + 8y             &\leq& 2000 \\
                  8y &\leq&1370 \qquad \textrm{and so} \\
                     y &\leq& 171.25.
\end{eqnarray*}
Also, according to the constraint on time, 
\begin{eqnarray*}
  12\times 126 + 8y &\leq& 2880 \\
1512             + 8y &\leq& 2880 \\
                        8y &\leq& 1368 \qquad \textrm{and so} \\
                           y &\leq& 171.
\end{eqnarray*}
To satisfy \textit{both} $y\leq 171.25$ and $y\leq 171$, $y\leq 171$.  So $x=126$ and $y=171$ also lies in the feasible region.  In fact, this solution would make more profit -- $\pounds 488.25$ -- and so the optimal solution is to make 126 bears and 171 cats.   
\newpage
\vspace{-2cm}
%\begin{center}
\includegraphics[height=26.5cm]{ex4graph2sol.ps}
%\end{center}

\end{itemize}


\item [\textbf{19.}] 
\begin{itemize}
\item [(a)] Formulation of the linear programming problem:

\vspace{0.5cm}

\textbf{Step 1: Decision variables}
\begin{eqnarray*}
x  &=& \textrm{no. of asteroids to make} \\
y  &=& \textrm{no. of blackholes to make}
\end{eqnarray*}

\vspace{0.5cm}

\textbf{Step 2: Constraints} \\
Drawing up a table:
\begin{center}
\begin{tabular}{|c|c c |c|} \hline
              &Cocoa (g)     &Machine Time (mins) &Profit (pence) \\ \hline
Asteroids        &10                               &1          &10     \\
Blackholes       &5                               &4           &20  \\ \hline
Limits        &2000                            &480        &    \\ \hline
\end{tabular}
\end{center}
This gives:
\begin{eqnarray*}
\textrm{Cocoa:} && 10x  + 5y \leq 2000 \\
\textrm{Machine Time:}    && x + 4y  \leq 480  
\end{eqnarray*}
We also have
\begin{eqnarray*}
        x&\geq& 50 \qquad \textrm{and} \\
        y&\geq& 50.
\end{eqnarray*}

\vspace{0.5cm}

\textbf{Step 3: Objective function}\\
The objective is to maximise profit $P$, where
\[
P = 10x+20y \textrm{ pence.}
\]

\vspace{0.5cm}

In summary, we have the following problem:
\\
\\
Maximise $P=10x+20y$ subject to the following constraints:
\begin{eqnarray*}
10x+5y &\leq& 2000 \\
x+4y &\leq& 480 \\
x   &\geq &50 \\
y   &\geq& 50.
\end{eqnarray*}

\newpage

\item [(b)] Following the process as in question 1 gives the graph shown overleaf.  

\vspace{0.5cm}

\item [(c)] You should see that maximum profit is given at $x\approx 160$ and $y\approx 80$, giving
\[
P = 10\times 160 + 20\times 80 = 3200 \textrm{ pence},
\]
that is, making 160 asteroid bars and 80 blackhole bars will maximise profit, giving \pounds 32 profit per day.  
\vspace{0.3cm}
Minimum profit is achieved when $x=y=50$ (to meet demand), giving
\[
P = 10\times50 + 20\times 50 = 1500 \textrm{ pence},
\]
i.e. \pounds 15 per day.  

\vspace{0.5cm}

\item [(d)]Algebraic solution (eliminate the $x$'s by subtraction):
\begin{eqnarray*}
10x+5y &=&2000 \\
\underline{10x+40y}&=& \underline{4800} \\
35y    &=&2800
\end{eqnarray*}
giving $y=80$.  Substituting $y=80$ back into one of the equations and solving for $x$ gives $x=160$, as in the graphical solution. 
\end{itemize}
%\end{itemize} 

\newpage
\vspace{-2cm}
%\begin{center}
\includegraphics[height=26.5cm]{ex4graph1sol.ps}
%\end{center}
%\end{comment}

\item [\textbf{20.}] The equations in (i) and (v) are \textit{not} quadratic equations, as the highest power of $x$ (after simplification) is 1 in both.  All other equations \textit{are} quadratics since their highest power of $x$ is 2. 

\item [\textbf{21.}] Recall that the discriminant is $D = b^{2}-4ac$.  In order to identify $a$, $b$ and $c$, it is best to have your quadratic in the form $ax^{2}+bx+c = 0$.  Then, the discriminants for each quadratic equation are as follows:
\begin{itemize}
\item [(ii)] $D = 11^{2}-(4\times 1 \times 28) = 9$.
\item [(iii)] Re--arranging, we get $x^{2}-4x-5 = 0$, giving $D=(-4)^{2}-(4\times 1 \times -5) = 36$.
\item [(iv)] $D = 3^{2} - (4\times 1 \times 1) = 5$.
\item [(vi)] Re--arranging, we get $x^{2}-6x-10 = 0$, giving $D = (-6)^{2} - (4\times 1 \times -10) = -4$.
\item [(vii)] $D = (-16)^2 - (4\times 1 \times 64) = 0$.
\end{itemize}
\begin{itemize}
\item [(a)] When $D>0$ we have two distinct solutions; when $D=0$ we have repeated solutions and when $D<0$ we have complex solutions.  Thus, we have two distinct solutions for equations (ii), (iii) and (iv); repeated solutions for equation (vii); and complex solutions for equation (vi).  
\item [(b)] For quadratics to be solved via factorisation, we need $D$ to be a perfect square -- i.e. $\sqrt{D}$ must be an integer value.  Thus, equations (ii), (iii) and (vii) can be solved using the method of factorisation; we will have to use the quadratic formula for equation (iv).   

\vspace{0.3cm}
\end{itemize}

In summary:
\begin{center}
\begin{tabular}{|c| c c c c|}\hline
Equation   &Quadratic?   &Discriminant     &Solutions?    &Method \\ \hline
(i)        &No           &---              &---           &---    \\
(ii)       &Yes          &9                &Distinct      &Factorisation \\
(iii)      &Yes          &36               &Distinct      &Factorisation \\
(iv)       &Yes          &5                &Distinct      &Formula       \\
(v)        &No           &---              &---           &--- \\ 
(vi)       &Yes          &--4              &Complex       &---     \\
(vii)      &Yes          &0                &Repeated      &Factorisation \\ \hline
\end{tabular}
\end{center}

\item [\textbf{22.}] 
\begin{itemize}
\item [(a)] For equation (ii):
\begin{eqnarray*}
x^{2}+11x+28   &=& 0 \\
(x+7)(x+4)     &=&0. 
\end{eqnarray*}
Thus $x+7=0$ or $x+4=0$, giving $x=-7$ or $x=-4$.
\\
\\
For equation (iii):
\begin{eqnarray*}
x^{2}-4x - 5 &=& 0 \\
(x-5)(x+1)  &=&0.
\end{eqnarray*}
Thus $x-5=0$ or $x+1=0$, giving $x=5$ or $x=-1$.  
\\
\\
For equation (vii):
\begin{eqnarray*}
x^{2}-16x+64   &=& 0 \\
(x-8)(x-8)     &=&0.
\end{eqnarray*}
Thus $x-8=0$, giving $x=8$.

\vspace{0.3cm}

\item[(b)] For equation (iv), we have $a=1$, $b=3$ and $c=1$. We also know that $D=5$, giving
\[
x  = \frac{-3\pm \sqrt{5}}{2}.
\]
So 
\[
x=\frac{-3+\sqrt{5}}{2}=-0.382
\]
or 
\[
x=\frac{-3-\sqrt{5}}{2} = -2.618.
\]

\end{itemize}


\item [\textbf{23.}] The company will break--even when their profit is zero, that is, at the points $q$ for which 
\[
-2q^{2}+9q-4 = 0.
\]
The discriminant is $D = 9^{2} - (4\times -2 \times -4) = 49$.  Since this is a perfect square, we can solve this quadratic using the method of factorisation or by using the formula.  Using the formula gives
\[
x = \frac{-9 \pm \sqrt{49}}{-4} = \frac{-9\pm7}{-4}.
\]
Thus,
\[
x = \frac{-9+7}{-4} = 0.5
\]
or
\[
x = \frac{-9-7}{-4} = 4.
\]
So the company will break even when they spend half a million pounds or 4 million pounds on advertising.  This can be seen in the sketch below:
\begin{center}
\psfrag{0}[][]{\sf \tiny 0} 
\psfrag{1}[][]{\sf \tiny 1} 
\psfrag{2}[][]{\sf \tiny 2} 
\psfrag{3}[][]{\sf \tiny 3} 
\psfrag{4}[][]{\sf \tiny 4} 
\psfrag{5}[][]{\sf \tiny 5} 

\psfrag{q}[][]{\sf \tiny $q$}
\psfrag{pi}[][]{\sf \tiny $\pi$}


\includegraphics[width=12cm,height=9cm]{pi.ps}
\end{center}

\newpage

\item [\textbf{24.}]  
\begin{itemize}
\item [(a)] The company's Taguchi loss function is
\[
L  = 4(x-2)^{2},
\]
where $x$ is the diameter of the hole (in mm).  A plot of $L$ against $x$ is shown below:
\begin{center}
\psfrag{0}[][]{\sf \tiny 0} 
\psfrag{1}[][]{\sf \tiny 1} 
\psfrag{2}[][]{\sf \tiny 2} 
\psfrag{3}[][]{\sf \tiny 3} 
\psfrag{4}[][]{\sf \tiny 4} 
\psfrag{5}[][]{\sf \tiny 5} 
\psfrag{6}[][]{\sf \tiny 6} 
\psfrag{7}[][]{\sf \tiny 7}
\psfrag{L}[][]{\sf \tiny $L$}
\psfrag{x}[][]{\sf \tiny $x$}
\psfrag{20}[][]{\sf \tiny 20} 
\psfrag{40}[][]{\sf \tiny 40} 
\psfrag{60}[][]{\sf \tiny 60} 
\psfrag{80}[][]{\sf \tiny 80} 
\psfrag{100}[][]{\sf \tiny 100} 
\psfrag{120}[][]{\sf \tiny 120}    
\includegraphics[width=12cm,height=9cm]{taguchi.ps}
\end{center}
\item [(b)] \begin{itemize}
\item [(i)]Clearly, from the graph, zero loss is attained when $x=2$mm.
\item [(ii)] This makes perfect sense: if the holes are drilled to exactly 2mm diameter, then no mistakes have been made and so the loss per circuitboard will be zero.  As we move away from this ideal, we would expect the loss to increase, and that is exactly what the graph shows.  
\end{itemize}

\item [(c)] Expanding the Taguchi loss function gives:
\[
4(x-2)(x-2) = 4\left(x^{2}-4x+4\right) = 4x^{2}-16x+16.
\]
At zero loss, we have 
\[
4x^{2}-16x+16 = 0,
\]
giving $a=4$, $b=-16$ and $c=16$, and a discriminant of
\[
D = (-16)^{2} - (4 \times 4 \times 16) = 0.
\]
Thus,
\[
x  = \frac{16 \pm \sqrt{0}}{8},
\]
giving
\[
x = \frac{16}{8} = 2,
\]
as can be seen on the graph.  
\item [(d)] The discriminant is 0, giving repeated solutions.  This can be seen on the graph as the curve just touches the $x$--axis at the point $x=2$.  
\end{itemize}

\end{itemize}


\newpage

\begin{center}
\LARGE
\textbf{Solutions to practice questions: Chapter 2}
\end{center}
\normalsize

\begin{itemize}
\item [\textbf{1.}] 
\begin{itemize}
\item [(a)] When $y=6x^{3}$,
\begin{eqnarray*}
\frac{dy}{dx}   &=& 18x^{2} \qquad \textrm{and} \\
                & & \\
\frac{d^{2}y}{dx^{2}} &=& 36x.
\end{eqnarray*}
\item [(b)]  When $y=7x^{4}-3x^{2}$,
\begin{eqnarray*}
\frac{dy}{dx}   &=&  28x^{3}-6x \qquad \textrm{and} \\
                & & \\
\frac{d^{2}y}{dx^{2}} &=& 84x^{2}-6.
\end{eqnarray*}
\item [(c)]  When $\displaystyle y=\frac{1}{2}x^{4}+\frac{1}{3}x^{3}+2x^{2}+6x-3$,
\begin{eqnarray*}
\frac{dy}{dx}   &=& 2x^{3}+x^{2}+4x+6 \qquad \textrm{and} \\
                & & \\
\frac{d^{2}y}{dx^{2}} &=&6x^{2}+2x+4.
\end{eqnarray*}
\item [(d)]  When $\displaystyle =\frac{1}{3}x^{3}+5x^{2}+9x+2$,
\begin{eqnarray*}
\frac{dy}{dx}   &=&  x^{2}+10x+9\qquad \textrm{and} \\
                & & \\
\frac{d^{2}y}{dx^{2}} &=& 2x+10.
\end{eqnarray*}
\item [(e)]  When $y=5x^{0.5}-\pi x$,
\begin{eqnarray*}
\frac{dy}{dx}   &=&  2.5x^{-0.5} -\pi= \frac{5}{2\sqrt{x}}-\pi\qquad \textrm{and} \\
                & & \\
\frac{d^{2}y}{dx^{2}} &=& -1.25x^{-1.5}.
\end{eqnarray*}
\item [(f)]  When $y=3x^{-1}+2$,
\begin{eqnarray*}
\frac{dy}{dx}   &=&  -3x^{-2} = -\frac{3}{x^{2}}\qquad \textrm{and} \\
                & & \\
\frac{d^{2}y}{dx^{2}} &=& 6x^{-3} = \frac{6}{x^{3}}.
\end{eqnarray*}
\item [(g)]  When $y=6x^{-0.5}-0.5x^{2}$,
\begin{eqnarray*}
\frac{dy}{dx}   &=& -3x^{-1.5}-x \qquad \textrm{and} \\
                & & \\
\frac{d^{2}y}{dx^{2}} &=& 4.5x^{-2.5}-1.
\end{eqnarray*}
\item [(h)]  When $y=x^{2}+6x-7$,
\begin{eqnarray*}
\frac{dy}{dx}   &=& 2x+6 \qquad \textrm{and} \\
                & & \\
\frac{d^{2}y}{dx^{2}} &=&2.
\end{eqnarray*}
\end{itemize}

\vspace{0.3cm}

\item [\textbf{2.}] 
\begin{itemize}
\item [(d)] We have $\displaystyle y=\frac{1}{3}x^{3}+5x^{2}+9x+2$.  

In question 1(d), we found that
\[
\frac{dy}{dx} = x^{2}+10x +9.
\]
For turning points, we know the gradient is zero.  Thus,
\begin{eqnarray*}
x^{2}+10x+9     &=& 0 \\
(x+9)(x+1)      &=&0,
\end{eqnarray*}
giving $x=-9$ and $x=-1$.  
\begin{itemize}
\item [$\bullet$] When $x=-9$,
\[
y = \frac{1}{3}(-9)^{3}+5(-9)^{2}+9(-9)+2 = 83.
\]
\item [$\bullet$] When $x=-1$,
\[
y = \frac{1}{3}(-1)^{3}+5(-1)^{2}+9(-1)+2 = -\frac{7}{3}.
\]
\noindent So we have turning points at $(-9,83)$ and $(-1,-7/3)$.  
\end{itemize}
In question 1(d), we also found that
\[
\frac{d^{2}y}{dx^{2}} = 2x+10.
\]
At the point $(-9,83)$, $x=-9$ and so
\[
\frac{d^{2}y}{dx^{2}} = 2\times -9+10 = -8;
\]
at the point $(-1,-7/3)$, $x=-1$ and so
\[
\frac{d^{2}y}{dx^{2}} = 2\times-1+10 = 8.
\]
Thus, the point $(-9,83)$ is a \textit{maximum} turning point since $\frac{d^{2}y}{dx^{2}}$ is negative; the point $(-1,-7/3)$ is a \textit{minimum} turning p4oint since $\frac{d^{2}y}{dx^{2}}$ is positive.  

\item [(e)]  We have $5\sqrt{x} - \pi x = 5x^{0.5}-\pi x$.  

In question 1(e), we found that
\[
\frac{dy}{dx} = 2.5x^{-0.5}-\pi = \frac{5}{2\sqrt{x}}-\pi.
\]
For turning points, we know the gradient is zero.  Thus,
\begin{eqnarray*}
\frac{5}{2\sqrt{x}}     &=& \pi  \\
\frac{5}{\pi}  &=&2\sqrt{x}  \\
\frac{5}{2\pi} &=& \sqrt{x}  \\
x   &=& \left(\frac{5}{2\pi}\right)^{2}.
\end{eqnarray*}
At this point,
\begin{eqnarray*}
y &=& 5\sqrt{x} - \pi x\\
  &=& 5\left(\frac{5}{2\pi}\right)-\pi\left(\frac{5}{2\pi}\right)^{2} \\
  &=&\frac{25}{2\pi} - \frac{25\pi}{4\pi^{2}} \\
& & \\
  &=& \frac{25}{2\pi} - \frac{25}{4\pi} \\
& & \\
  &=&\frac{25}{4\pi}.
\end{eqnarray*} 
So we have a turning point at $\displaystyle \left(\left[\frac{5}{2\pi}\right]^{2},\frac{25}{4\pi}\right)$.  

In question 1(e), we also found that
\[
\frac{d^{2}y}{dx^{2}} =  -1.25x^{-1.5}.
\]
At the turning point, $\displaystyle x=\left(\frac{5}{2\pi}\right)^{2} = 0.63326$ and so
\[
\frac{d^{2}y}{dx^{2}} = -1.25\times (0.63326^{-1.5}) = -2.48,
\]
which is negative, indicating that we have a \textit{maximum} turning point.  
\newpage
\item [(h)] We have $y=x^{2}+6x-7$.  

In question 1(h), we found that
\[
\frac{dy}{dx} = 2x+6.
\]
For turning points, we know the gradient is zero.  Thus,
\begin{eqnarray*}
2x +6  &=& 0 \qquad \textrm{i.e.} \\
     2x &=&-6 \qquad \textrm{and so} \\
      x  &=&-3.
\end{eqnarray*}
At this point, 
\[
y=(-3)^{2}+6(-3)-7 = -16,
\]
so we have a turning point at $(-3,-16)$.  

In question 1(h), we also found that
\[
\frac{d^{2}y}{dx^{2}} = 2,
\]
which is positive for all values of $x$, and so we have a \textit{minimum} turning point.  
\end{itemize}

\vspace{0.5cm}

\item [\textbf{3.}] To find a derivative from first principles, we consider the gradient of the chord between the points $(x,f(x))$ and $(x+\delta,f(x+\delta))$.  

When $f(x) = 6x^{3}$, as in question 1(a), our two points will be 
\[
(x, 6x^{3})  \qquad \textrm{and} \qquad (x+\delta, 6(x+\delta)^{3}).
\]
The gradient is given by
\begin{eqnarray*}
\textrm{Gradient}   &=& \frac{\textrm{Change in $y$}}{\textrm{Change in $x$}} \\
   & & \\
                    &=&\frac{6(x+\delta)(x+\delta)(x+\delta) - 6x^{3}}{x+\delta-x}\\
 & & \\
                    &=&\frac{6(x^{2}+2x\delta+\delta^{2})(x+\delta)-6x^{3}}{\delta} \\
 & & \\
                   &=&\frac{6(x^{3}+\delta x^{2} +2x^{2}\delta+2x\delta^{2}+x\delta^{2}+\delta^{3})-6x^{3}}{\delta} \\
& & \\
                   &=& \frac{6(x^{3}+3\delta x^{2}+3x\delta^{2}+\delta^{3})-6x^{3}}{\delta} \\
& & \\
                   &=&\frac{6x^{3}+18\delta x^{2} + 18\delta^{2}x + \delta^{3}-6x^{3}}{\delta} \\
 & & \\
                  &=&\frac{18\delta x^{2}+18\delta^{2}x+\delta^{3}}{\delta} = 18x^{2}+18\delta x + \delta^{2}.  
\end{eqnarray*} 
Now, as $\delta \rightarrow 0$, we are left with just
\[
\textrm{Gradient} = 18x^{2},
\]
exactly the answer we got in question 1(a).  We can work out $\displaystyle \frac{d^{2}y}{dx^{2}}$ from first principles in exactly the same way, starting with the function $f(x) = 18x^{2}$.

\newpage

\item [\textbf{4.}] We have
\[
p = -0.2t^{2}+8t-70.
\]
Thus,
\[
\frac{dp}{dt} = -0.4t+8.
\]
At the turning point the gradient is zero, and so
\begin{eqnarray*}
-0.4t +8 &=& 0 \\
   0.4t  &=&8 \\
       t &=&20.
\end{eqnarray*}
So the turning point occurs at $20^{\textrm{o}}\textrm{C}$.  Just to check that this \textit{is} a maximum turning point,
\[
\frac{d^{2}p}{dt^{2}} = -0.4,
\]
which is negative for all values of $t$; thus, we do indeed have a maximum!  


\vspace{0.5cm}

\item [\textbf{5.}] We have $P=-Q^{3}+20Q^{2}-7Q-1$.  
\[
\frac{dP}{dQ} = -3Q^{2}+40Q-7.
\]
At the turning points the gradient is zero.  Thus
\[
-3Q^{2}+40Q-7  = 0.
\]
The discriminant is $D=b^{2}-4ac = 40^{2}-(4\times -3 \times -7) =1516$.  Thus, by the quadratic formula,
\[
Q = \frac{-40 \pm \sqrt{1516}}{-6},
\]
giving
\[
Q  = \frac{-40+\sqrt{1516}}{-6} = 0.177,
\]
and
\[
Q = \frac{-40 -\sqrt{1516}}{-6} = 13.156.
\]
\noindent Now
\[
\frac{d^{2}Q}{dP^{2}} = -6Q+40,
\]
which is  positive at $Q=0.177$ and negative at $Q=13.156$, meaning that at $Q=0.177$ we have a \textit{minimum} turning point and at $Q=13.156$ we hav a \textit{maximum} turning point.  

Thus, profit is minimised when we produce 0.177 litres of fruit juice per hour, and profit is maximsed when we produce 13.156 litres of fruit juice per hour.  The maximum profit will thus be
\[
P = -(13.156)^{3}+20(13.156)^{2}-7(13.156)-1 = \pounds 1091.47.
\]


\vspace{0.5cm}

\item [\textbf{6.}] 
\begin{itemize}
\item [(a)] We have 
\[
f_{x} = 20x^3; \quad \textrm{and} \quad f_{y} = 2y.
\]
Therefore,
\begin{eqnarray*}
f_{xx}  &=& 60x^2 \\
f_{yy}  &=& 2 \\
f_{xy}  &=& 0 \\
f_{yx}  &=& 0
\end{eqnarray*}
\item [(b)] We have
\[
f_{x} = 2xy^{3}-10 \quad \textrm{and} \quad f_{y} = 3x^{2}y^{2}.
\]
Therefore,
\begin{eqnarray*}
f_{xx}  &=& 2y^{3} \\
f_{yy}  &=& 6x^{2}y \\
f_{xy}  &=& 6xy^{2} \\
f_{yx}  &=& 6xy^{2} 
\end{eqnarray*}
\end{itemize}

\vspace{0.5cm}

\item [\textbf{7.}] 
\begin{eqnarray*}
f_{1}   &=& x_{2} + 5x_{1}^{4} \\
f_{11}  &=& 20x_{1}^{3} \\
f_{21}  &=& 1
\end{eqnarray*}


\end{itemize}



\newpage

\begin{center}
\LARGE
\textbf{Solutions to practice questions: Chapter 3}
\end{center}
\normalsize

\begin{itemize}
\item[\textbf{1.}]
Data types:
\begin{itemize}
\item[(a)] Qualitative $\rightarrow$ Categorical
\item[(b)] Quantitative $\rightarrow$ Continuous
\item[(c)] Quantitative $\rightarrow$ Discrete $\rightarrow$ Ordinal
\item[(d)] Quantitative $\rightarrow$ Discrete
\end{itemize}

\vspace{0.3cm}

\item [\textbf{2.}] 
\begin{itemize}
\item [(a)] Accessibility sampling.  Could be flawed as it is non--random and is prone to bias.  
\item [(b)] Difficult -- if not impossible -- to get a complete list of everyone in the target population.
\item [(c)] Judgemental sampling.  
\end{itemize}

\vspace{0.3cm}

\item [\textbf{3.}] Stem--and--leaf plot:
\begin{center}
\begin{tabular}{c|c c c c c c c c c}
9    &3  &  & &  &   \\
9    &7 &7 &8 &  & \\
10   &0 &0 &3 &4 &4 \\
10   &5 &6 &8 &  &\\
11   &2 &  &  &  &\\
11   &  &  &  &  &\\
12   &4 &  &  &  &\\
\end{tabular}

$n=14$ \hspace{1cm} Stem unit = 1 \hspace{1cm} Leaf unit = 0.1
\end{center}

\item [\textbf{4.}] 
\begin{itemize}
\item [(a)]
\begin{itemize}
\item [(i)] Stratified random sampling, as we have randomly sampled within the strata ``male'' and ``female'', making sure the sampling proportions reflect those of the population.  Advantage: More likely to get a representative sample. Disadvantage: Might be difficult to get a complete list of everyone in the population.  This type of sampling is truly random.
\item [(ii)] Relative frequency table for data on number of calls:

\vspace{0.5cm}

\begin{center}
\begin{tabular}{|c|l|c|c|}
\hline
\textbf{Calls made} & \textbf{Tally} & \textbf{Frequency} &
\textbf{Relative Frequency \%}\\
\hline
 95 & \one           &  1 &  2 \\ 
 96 & \two           &  2 &  4 \\ 
 97 & \three         &  3 & 6 \\ 
 98 & \five\two      &  7 &  14 \\ 
 99 & \five\five\four&   14 &  28 \\
100 & \five\three    &  8 &  16 \\ 
101 & \five\three    &  8 &  16 \\ 
102 & \four          &  4 &  8 \\ 
103 & \two           &  2 &  4 \\ 
104 & \one           &  1 &  2 \\ 
\hline
\textbf{Totals} & & 50 & 100 \\
\hline
\end{tabular}
\end{center}
 \end{itemize}

\vspace{0.3cm}

\item [(b)] 
\begin{itemize}
\item [(i)] Simple random sampling.
\item [(ii)] Daniel seems to be a bit of an outlier -- provided our sample is representative of the class as a whole, Daniel makes almost half the number of calls of most students in the class.
\item [(iii)] Relative frequency table for length of call data:

\vspace{0.5cm}

\begin{center}
\begin{tabular}{|c|l|c|c|}
\hline
\textbf{Length of call} & \textbf{Tally} & \textbf{Frequency} &
\textbf{Relative Frequency \%}\\
\hline
$250\leq length <260$ & \two         &  2 &4 \\
$260\leq length <270$ & \three       &  3 &6 \\
$270\leq length <280$ & \two         &  2 &4 \\
$280\leq length <290$ & \five\two    &  7 &  14 \\
$290\leq length <300$ & \five\four   &  9 &  18 \\
$300\leq length <310$ & \five\five\two&   12 &  24 \\
$310\leq length <320$ & \five\four   &  9 &  18 \\
$320\leq length <330$ & \four        &  4 &8 \\
$330\leq length <340$ & \one         &  1 &2 \\
$340\leq length <350$ & \one         &  1 &2 \\
\hline
\textbf{Totals} & & 50 & 100 \\
\hline
\end{tabular}
\end{center}

\vspace{0.5cm}

This gives the following histogram:

\vspace{0.5cm}

\begin{center}
\psfrag{260}[][]{\sf \tiny 260}
\psfrag{280}[][]{\sf \tiny 280}
\psfrag{300}[][]{\sf \tiny 300}
\psfrag{320}[][]{\sf \tiny 320}
\psfrag{340}[][]{\sf \tiny 340}
\psfrag{0}[][]{\sf \tiny 0}
\psfrag{2}[][]{\sf \tiny 2}
\psfrag{4}[][]{\sf \tiny 4}
\psfrag{6}[][]{\sf \tiny 6}
\psfrag{8}[][]{\sf \tiny 8}
\psfrag{10}[][]{\sf \tiny 10}
\psfrag{12}[][]{\sf \tiny 12}
\psfrag{c}[][]{\sf \tiny Call time}
\psfrag{0}[][]{\sf \tiny 0}
\psfrag{f}[][]{\sf \tiny Frequency}
\psfrag{H}[][]{\sf \scriptsize Histogram of call time data}
\includegraphics[width=10cm,height=7.5cm]{callshist.ps}
\end{center}

\end{itemize}
\end{itemize}

\newpage

\item [\textbf{5.}] 
\begin{itemize}
\item [(a)] The percentage relative frequencies are:

\vspace{0.5cm}

\begin{center}
\begin{tabular}{|c|c|c|}
\hline
\textbf{Daily Sales} & \textbf{Before} & \textbf{After}\\
\hline
$1000 \leq \textrm{sales} < 2000$ &  6.9 &  3.7\\
$2000 \leq \textrm{sales} < 3000$ &  20.7 &  5.3\\
$3000 \leq \textrm{sales} < 4000$ &  27.6 &  13.2\\
$4000 \leq \textrm{sales} < 5000$ &  13.8 &  18.5\\
$5000 \leq \textrm{sales} < 6000$ &  10.3 &  19.6\\
$6000 \leq \textrm{sales} < 7000$ &  8.3 &  21.2\\
$7000 \leq \textrm{sales} < 8000$ &  6.9 &  10.6\\
$8000 \leq \textrm{sales} < 9000$ &  5.5 &   5.3\\
$9000 \leq \textrm{sales} < 10000$ & 0.0 &  2.6\\
\hline
\textbf{Totals} & 145 & 189\\
\hline
\end{tabular}
\end{center}

\vspace{0.5cm}

\item [(b)] Plotting the polygons, where ``B''=Before and ``A''=After, gives the graph below. Notice that sales after the advertising campaign are, on average, higher than those beforehand.  Also, the distribution of sales in the before period is asymmetric (and positively skewed); sales in the after period are fairly symmetric.  

\vspace{0.25cm}

\begin{center}
\psfrag{0}[][]{\sf \tiny 0}
\psfrag{5}[][]{\sf \tiny 5}
\psfrag{10}[][]{\sf \tiny 10}
\psfrag{15}[][]{\sf \tiny 15}
\psfrag{20}[][]{\sf \tiny 20}
\psfrag{25}[][]{\sf \tiny 25}
\psfrag{30}[][]{\sf \tiny 30}
\psfrag{2000}[][]{\sf \tiny 2000}
\psfrag{4000}[][]{\sf \tiny 4000}
\psfrag{6000}[][]{\sf \tiny 6000}
\psfrag{8000}[][]{\sf \tiny 8000}

\psfrag{M}[][]{\sf \tiny Midpoint}
\psfrag{S}[][]{\sf \tiny Sales}

\includegraphics[width=9cm,height=6cm]{polygons8.ps}
\end{center}

\end{itemize}

\item [\textbf{6.}] A simple bar chart or pie chart will do here:

\vspace{0.25cm}

\begin{center}
\psfrag{0}[][]{\sf \tiny 0}
\psfrag{50}[][]{\sf \tiny 50}
\psfrag{100}[][]{\sf \tiny 100}
\psfrag{150}[][]{\sf \tiny 150}
\psfrag{200}[][]{\sf \tiny 200}
\psfrag{S}[][]{\sf \tiny Sun}
\psfrag{T}[][]{\sf \tiny Times}
\psfrag{G}[][]{\sf \tiny Guard.}
\psfrag{M}[][]{\sf \tiny Mirror}
\psfrag{P}[][]{\sf \tiny Sport}
\psfrag{I}[][]{\sf \tiny Ind.}
\psfrag{F}[][]{\sf \tiny FT}
\psfrag{D}[][]{\sf \tiny Mail}
\psfrag{q}[][]{\sf \tiny Frequency}
\includegraphics[width=10cm,height=7.5cm]{papers.ps}
\end{center}

\item[\textbf{7.}]
\begin{itemize}
\item[(i)] Let the weight of sack $ i $ be $ x_{i}. $ The sum of the weights is
\[ \sum_{i=1}^{50} x_{i} = 505.8. \]
Therefore the sample mean is 
\[ \bar{x} = \frac{1}{50}\sum_{i}^{50}x_{i} = \frac{505.8}{50}=10.116\,{\rm kg} . \]

\item[(ii)] Grouping these data into a frequency table gives
\begin{center}
\begin{tabular}{|r|c|c|c|}
\hline
\textbf{Class} $ j $ & \textbf{Class Interval} & \textbf{Mid-point $(m_j)$} &
\textbf{Frequency $(f_j)$}\\
\hline
1 & $ 8.0 \leq x <8.5 $ &  8.25 & 2\\
2 & $ 8.5 \leq x <9.0 $ &  8.75 & 4\\
3 & $ 9.0 \leq x <9.5 $ &  9.25 & 4\\
4 & $ 9.5 \leq x <10.0$ &  9.75 & 9\\
5 & $10.0 \leq x <10.5$ & 10.25 & 14\\
6 & $10.5 \leq x <11.0$ & 10.75 & 9\\
7 & $11.0 \leq x <11.5$ & 11.25 & 5\\
8 & $11.5 \leq x <12.0$ & 11.75 & 2\\
9 & $12.0 \leq x <12.5$ & 12.25 & 0\\
10 & $12.5 \leq x <13.0$ & 12.75 & 1\\
\hline
\textbf{Total ($n$)} & & & 50\\
\hline
\end{tabular}
\end{center}

\item [(iii)] Using the grouped data, the approximation of the sample mean is
\begin{equation*}
\bar x \approx \frac{1}{50}\sum_{j=1}^{10} f_jm_j
= \frac{1}{50}\left(2\times 8.25 + 4\times 8.75 + \cdots 
+ 1\times 12.75\right)= \frac{507}{50}=10.14\, {\rm kg}.
\end{equation*}
This value is fairly close to the correct sample mean (in 1 above). This is an estimate of the sample mean because we are assuming all values within each class interval take the mid--point.  

\item[(iv)] We can put the observations into increasing order.
{\small
\begin{verbatim}
 8.1    8.2    8.5    8.7    8.8    8.9    9.2    9.3    9.3    9.4
 9.5    9.5    9.6    9.6    9.6    9.7    9.7    9.9    9.9   10.0
10.0   10.0   10.0   10.0   10.1   10.2   10.2   10.2   10.3   10.3
10.4   10.4   10.4   10.5   10.6   10.6   10.6   10.6   10.6   10.7
10.8   10.9   11.0   11.2   11.3   11.3   11.3   11.5   11.6   12.8
\end{verbatim}
}

As there are $n=50$ observations, the median $ M $ is the
$(50+1)/2=25\,\frac{1}{2}$th smallest observation, that is, half way
between the 25th and 26th smallest observations:
\[
M=\frac{10.1+10.2}{2}=10.15\,{\rm kg}.
\]

\item [(v)] The model class in the grouped frequency table is the class with the largest frequency, that is class 5, with $10.0 \leq x <10.5.$

\item [(vi)] The range of the data is the difference between the largest and
smallest observations. Here the minimum and maximum values are
min $=8.1 $ kg and max $ =12.8 $ kg and so the range is
\[
{\rm Range}\ = {\rm max}\ - {\rm min}\ =12.8-8.1=4.7 {\rm kg}.
\]

\item [(vii)] The interquartile range is the difference between the upper and
lower quartiles. As there are $n=50$ observations, the lower quartile
is the $(50+1)/4=12\,\frac{3}{4}$th smallest observation, that is,
three quarters of the way
between the 12th and 13th smallest observations:
\[
Q_{1}=\frac{1}{4}\times 9.5 +\frac{3}{4}\times 9.6=9.575\,{\rm kg}.
\]
Similarly, the upper quartile is the $3(50+1)/4=38\,\frac{1}{4}$th
smallest observation, that is, a quarter of the way between the
38th and 39th smallest observations. As both of these observations are
$10.6 $ kg, we have
\[
Q_{3}=10.6\,{\rm kg}.
\]
Therefore, the interquartile range is
\[
{\rm IQR}\ =Q_{3}-Q_{1}=10.6-9.575=1.025\,{\rm kg}.
\]

\item [(viii)] The sample standard deviation is best calculated either using
MINITAB (see next semester) or your calculator in SD mode. However we can also do the calculation the long way. We find

\[ \sum_{i=1}^{50} x_{i}^{2}=5157.54. \]
Therefore the sample variance is
\begin{eqnarray*}
 s^{2} & = & \frac{1}{n-1} \left\{ \sum_{i=1}^{n} x_{i}^{2} - n \bar{x}^{2} \right\} \\
       & = & \frac{ 5157.54 - 50 \times 10.116^{2}}{49} \\
       & = & 0.834024
\end{eqnarray*}

The sample standard deviation is 
\[
s= \sqrt{s^{2}} = \sqrt{0.834024} = 0.913\,kg.
\]
Note that this is the value obtained on calculators using the $s$ or
$\sigma_{n-1}$ button and not the $\sigma$ or $\sigma_n$ button.


\end{itemize}

\newpage

\item [\textbf{8.}]
\begin{itemize}
\item [(a)] 
\begin{eqnarray*}
\bar{x} &=& \frac{30+28+\ldots+1}{10} = 26.8 \textrm{ planes per hour.} 
\end{eqnarray*}
Putting the data in ascending order:
\begin{center}
\begin{tabular}{c c c c c c c c c c}
1  &25  &27  &27  &28  &30  &30  &32  &33  &35
\end{tabular}
\end{center}
Thus
\[
\textrm{Median} = \frac{28+30}{2} = 29.
\]
\item[(b)] The range is largest minus smallest, that is
\[
35-1 = 34.
\]
For the IQR, we need the lower and upper quartiles.  The \textit{position} of these values is
\[
\frac{11}{4} = 2.75 \qquad \textrm{ and } \qquad \frac{3\times 11}{4} = 8.25,
\]
respectively.  Thus, we have
\[
Q_1  = 26.5 \qquad \textrm{ and } \qquad Q_3 = 32.25,
\]
giving $IQR = 32.25-26.5 = 5.75$.  

For the variance, we have
\begin{eqnarray*}
s^{2} &=& \frac{1}{n-1}\left\{\sum x^{2} - n\bar{x}^{2}\right\} \\
      &=&\frac{1}{9}\left\{8006 - 10\times 26.8^2\right\} \\
      &=&91.511;
\end{eqnarray*}
Thus, the standard deviation is
\[
s = \sqrt{91.511} = 9.566 \textrm{ planes per hour.}
\]
\item [(c)] We clearly have a negatively skewed dataset if we include the last observation -- this is clearly an outlier, since the runway was closed for most of the hour and so it wasn't possible to observe a ``typical'' number of planes.  Thus, the median and IQR might be the most suitable summaries of location and spread to use here (respectively), as these are not distorted by extremely large/small observations.  The least suitable measure of location would be the mean, which can be distorted by outliers; the range would be the least suitable measure of spread, for the same reasons.  
\item [(d)] Box--and--whisker plot:

\vspace{-4cm}

\begin{center}
\includegraphics[height=14cm,angle=-90]{planes.ps}
\end{center}
\end{itemize}

\newpage

\item [\textbf{9.}] 
\begin{itemize}
\item [(a)] Yes -- there is an outlier in this dataset (51.3), and both the mean and standard deviation can be distorted by such values.
\item [(b)] \begin{itemize}
\item [(i)] 
\begin{eqnarray*}
\bar{x}_{g}   &=& \sqrt[10]{27.1\times 22.4 \times 26.5 \times \ldots \times 25.4} \\
   & & \\
   &=&27.102 \textrm{ grams.}
\end{eqnarray*}
\item [(ii)] No -- the $\bar{x}_{g}$ is still distorted by outliers as it takes into account the actual magnitude of observations in its calculation, rather than just the \textit{position} (i.e. the median).  
\end{itemize}
\item [(d)] Perhaps the median and interquartile range.  Try this yourself -- you should get
\begin{eqnarray*}
\textrm{Median}   &=& 25.8 \qquad \textrm{and} \\
IQR &=& 26.65- 24.525 = 2.125
\end{eqnarray*}
\end{itemize}

\end{itemize}

\newpage

\begin{center}
\LARGE
\textbf{Solutions to practice questions: Chapter 4}
\end{center}
\normalsize

\begin{itemize}
\item[\textbf{1.}] \begin{itemize}
\item [(a)] There are 4 female students out of 18. So the probability that the student is female is

\[ \frac{4}{18} = 0.2222. \]

\item [(b)] There are 6 students with weights greater than 70kg. So the probability that the student's weight is greater than 70kg.\ is

\[ \frac{6}{18} = 0.3333. \]

\item [(c)] There are 4 students with weights greater than 70kg.\ and shoe-sizes greater than 8. So the probability of choosing such a student is

\[ \frac{4}{18} = 0.2222. \]

\item [(d)] There are 8 students with weights greater than 70kg.\ or shoe-sizes greater than 8. So the probability of choosing such a student is

\[ \frac{8}{18} = 0.4444. \]
\end{itemize}

\vspace{0.5cm}

\item [\textbf{2.}] 
\begin{itemize}
\item[(a)]  We are told that the product fails if any of $A$, $B$ or $C$
fail. Therefore
\begin{align*}
P&(A,B,C\text{ all last for at least a year})\\
&=P(A\text{ lasts for at least a year AND }B\text{ lasts for at least
a year AND }C\text{ lasts for at least a year})\\
&=P(A\text{ lasts for at least a year})\times P(B\text{ lasts for at least a year})\times P(C\text{ lasts for at least a year})
\end{align*}
assuming the components fail independently, and so
\[
P(A,B,C\text{ all last for at least a year})
=0.98\times 0.99\times 0.95 =0.92169.
\]
\item[(b)]
\begin{align*}
P(\text{product is returned for a refund})
&=1-P(\text{product is not returned for a refund})\\
&=1-P(A,B,C\text{ all last for at least a year})\\
&=1-0.92169\\
&=0.07831.
\end{align*}
\end{itemize}

\vspace{0.5cm}

\item [\textbf{3.}] 
\begin{itemize}
\item [(a)] We \textit{might} expect $E$ and $F$ to be \textit{dependent} -- the higher a person's IQ, the more intelligent they are and this might have a bearing on their ability to secure a place at University... you may have your own thoughts on this, though!
\item [(b)] Surely $A$ and $B$ must be \textit{independent} -- although there is an argument which suggests that people who are good at maths have better spatial awareness, and this \textit{might}  make you a better table tennis player!
\item [(c)] Events $E_1$ and $E_2$ must be \textit{dependent} -- a large outstanding credit card debt might not look favourably on you, and so this might make the bank less willing to extend your overdraft!
\end{itemize}

\vspace{0.5cm}

\item [\textbf{4.}] Tree diagram:
\begin{center}
\includegraphics[width=8cm]{treetut11.ps}
\end{center}
\begin{itemize}
\item [(a)] 
\[
P(SSS) = 0.9^{3} = 0.729.
\]
\item [(b)]
\[
P(FSS) = 0.1\times0.5^{2} = 0.025.
\]
\item [(c)] 
\[
P(\textrm{only one successful log--in}) = P(SFF)+P(FSF)+P(FFS) = 0.045+0.025+0.025 = 0.095.
\]
\item [(d)] 
\[
P(FFF) = 0.1 \times 0.5^{2} = 0.025
\]
\end{itemize}

\vspace{0.5cm}

\item [\textbf{5.}] 
\begin{itemize}
\item [(a)] $X\sim Bin(10,0.3)$
\item [(b)] $Y\sim Po(7)$
\item [(c)] $Z\sim Bin(12, 0.1)$
\end{itemize}

\newpage

\item [\textbf{6.}] 
\begin{itemize}
\item [(a)] Assuming that calls are answered independently, $X\sim Bin(20,0.6)$. 
\item [(b)] The mean and variance are
\begin{align*}
E(X)&=np=20\times 0.6=12\\
Var(X)&=np(1-p)=20\times 0.6\times 0.4=4.8
\intertext{and so}
SD(X)&=\sqrt{Var(X)}=\sqrt{4.8}=2.19.
\end{align*}

\item [(c)]
\begin{align*}
P(X=9)&=\comb{n}{r}p^r(1-p)^{n-r}\\
&=\comb{20}{9}\times 0.6^9\times (1-0.6)^{11}	\\
&= 167960 \times 0.010077696 \times 0.000041943	\\
&= 0.071.
\end{align*}

\item [(d)]
\begin{align*}
P(X<2)&=P(X=0)+P(X=1)\\
&=\comb{20}{0}\times 0.6^0\times (1-0.6)^{20-0}
+\comb{20}{1}\times 0.6^1\times (1-0.6)^{20-1}\\
&=0.00000001+0.000000329	\\
&=0.000000339.
\end{align*}
\end{itemize}

\vspace{0.5cm}

\item [\textbf{7.}]  
\begin{itemize}
\item [(a)] $X\sim Po(10)$

\item [(b)] The mean and variance are
\begin{align*}
E(X)&=\lambda=10\\
Var(X)&=\lambda=10
\intertext{and so}
SD(X)&=\sqrt{Var(X)}=\sqrt{10}=3.16.
\end{align*}

\item [(c)]
\begin{align*}
P(X=12)&=\dfrac{\lambda^r e^{-\lambda}}{r!}\\
&=\dfrac{10^{12}\times e^{-10}}{12!}\\
&=0.09478.
\end{align*}

\item [(d)]
\begin{align*}
P(X\leq 2)&=P(X=0)+P(X=1)+P(X=2)\\
&=\dfrac{10^0\times e^{-10}}{0!}+\dfrac{10^1\times e^{-10}}{1!}
+\dfrac{10^2\times e^{-10}}{2!}\\
&=e^{-10}+10e^{-10}+50e^{-10}\\
&=0.0000454+0.0004540+0.0022700\\
&=0.00277.
\end{align*}
\end{itemize}

\item[\textbf{8.}]
\begin{itemize}
\item [(a)] $X\sim \textrm{Bin}(3,0.89)$.
\item [(b)] $E[X] = 3\times 0.89 = 2.67 \textrm{ orders}$; $SD(X) = \sqrt{3\times0.89\times0.11} =0.542 \textrm{ orders}$.
\item [(c)] 
\begin{eqnarray*}
P(X\geq 2) &=& P(X=2) + P(X=3) \\
           &=& \comb{3}{2}0.89^{2}0.11^{1} + \comb{3}{3}0.89^{3}0.11^{0} \\
           &=& 0.261393+0.704969 = 0.9664.
\end{eqnarray*}
\end{itemize}

\vspace{0.5cm}

\item [\textbf{9.}] Let $X: \textrm{ no. of years in which stock market rises}$; also, $X\sim \textrm{Bin}(5,0.64)$. So:
\begin{itemize}
\item [(a)] 
\[
P(X=4) = \comb{5}{4}0.64^{4}0.36^{1} = 0.3020;
\]
\item [(b)] 
\[
P(X=0) = \comb{5}{0}0.64^{0}0.36^{5} =0.0060.
\]
\item [(c)] We are assuming that changes in the stock market happen independently year--on--year -- perhaps not a valid assumption!
\end{itemize}

\vspace{0.5cm}

\item [\textbf{10.}] 
\begin{itemize}
\item [(a)] $X \sim \textrm{Po}(4)$.
\item [(b)] $E[X] = 4 \textrm{ holidays}$, $SD(X) = \sqrt{4} = 2 \textrm{ holidays}$.
\item [(c)] 
\[
P(X=3) = \frac{e^{-4}4^{3}}{3!} = 0.1954. 
\]
\item [(d)] 
\[
P(X=0) = \frac{e^{-4}4^{0}}{0!} =0.0183.
\]
\item [(e)] 
\[
P(X\geq 1) = 1-P(X=0) = 1-0.0183 = 0.9817. 
\]
\item [(f)] $Y\sim \textrm{Bin}(7,0.0183)$, giving
\[
P(Y<2) = P(Y=0)+P(Y=1) = \comb{7}{0}0.0183^{0}0.9817^{7} + \comb{7}{1}0.0183^{1}0.9817^{6} = 0.9934. 
\]
\end{itemize}


\item [\textbf{11.}]  Let $X: \textrm{no. of customers signed up}$; $X\sim\textrm{Bin}(n,p)$, and $E[X]=2.2$ with $Var(X)=1.76$.  
\begin{itemize}
\item [(a)] We know that 
\[
E[X] = n\times p = 2.2; 
\]
thus, $n=2.2/p$.  We also know that 
\[
Var(X) = n\times p\times(1-p) = 1.76;
\]
substituting $n=2.2/p$ into the above expression and solving for $p$ gives:
\begin{eqnarray*}
\frac{2.2}{p} \times p \times (1-p)  &=&1.76 \\
   & & \\
2.2(1-p)   &=&1.76 \\
    1-p    &=&0.8 \\
       p   &=&0.2.
\end{eqnarray*}
Substituting $p=0.2$ into the expression for $E[X]$ gives
\[
n = 2.2/0.2 =11,
\]
and so $X\sim \textrm{Bin}(11,0.2)$.
\item[(b)] 
\begin{eqnarray*}
P(X\geq 9) &=& P(X=9)+P(X=10)+P(X=11) \\
           &=& \comb{11}{9}0.2^{9}0.8^{2} + \comb{11}{10}0.2^{10}0.8^{1} + \comb{11}{11}0.2^{11}0.8^{0} \\
           &=&0.0000189.
\end{eqnarray*}
\end{itemize}

\vspace{0.5cm}

\item[\textbf{12.}] Let $Y: \textrm{ no. of mishandled bags (per 1000 passengers)}$; we have $Y\sim Po(3.89)$.  
\begin{itemize}
\item [(a)] 
\[
P(Y=0) = \frac{e^{-3.89}3.89^{0}}{0!} = 0.0204. 
\]
\item [(b)] 
\[
P(Y\geq 1) = 1-P(Y=0) = 1-0.0204 = 0.9796.
\]
\item [(c)] 
\[
P(Y=2) = \frac{e^{-3.89}3.89^{2}}{2!} = 0.1547.
\]
\item [(d)] $E[Y]=3.89\textrm{ bags}$; $SD(Y) = \sqrt{3.89} =1.9723 \textrm{ bags}$.
\item [(e)] Let $Z_{1}: \textrm{ no. of mishandled bags (per 200 passengers)}$. Then $Z_{1}\sim Po(0.778)$.  So 
\[
P(Z_{1}=1) = \frac{e^{0.778}0.778^{1}}{1!} =0.3574.
\]
\item [(f)] Let $Z_{2}: \textrm{ no. of mishandled bags (per 100 passengers)}$. Then $Z_{2}\sim Po(0.389)$.  So 
 \[
P(Z_{2} = 1) = \frac{e^{-0.389}0.389^{1}}{1!} = 0.2636.
\]
So, the probability that there is exactly one mishandled bag on \textit{both} of these flights, using the multiplication law of probability, is just
\[
0.3574 \times 0.2636 = 0.0942.
\]
\end{itemize}
\end{itemize}

\newpage


\begin{center}
\LARGE
\textbf{Solutions to practice questions: Chapter 5}
\end{center}
\normalsize

\begin{itemize}
\item[\textbf{1.}] The amount of liquid discharged $X$ has a normal distribution with
mean $\mu=200$ml and standard deviation $\sigma=15$ml.
\begin{itemize}
\item [(a)] The probability that a cup contains less than $170$ml is
$P(X<170)$. Now 
\[
z=\dfrac{170-\mu}{\sigma}=\dfrac{170-200}{15}=-2
\]
and from tables we obtain $P(Z<-2)=0.0228$. Therefore
\[
P(X<170)=0.0228=2.28\%.
\]

\item[(b)] The probability that a cup contains over $225$ml is
$P(X>225)$. Now $P(X>225)=1-P(X\leq 225)$. Also
\[
z=\dfrac{225-\mu}{\sigma}=\dfrac{225-200}{15}=1.6667
\]
and from tables we obtain $P(Z<1.67)=0.9525$. Therefore
\[
P(X>225)=1-0.9525=0.0475=4.75\%.
\]

\item [(c)] The probability that the cup contains between 175ml and 225ml is
\begin{align*}
P(175<X<225)
&=P(X<225)-P(X\leq 175).
\intertext{From (a), using tables we have $P(X<225)=0.9525$. Also}
z&=\dfrac{175-\mu}{\sigma}=\dfrac{175-200}{15}=-1.6667
\intertext{and from tables we obtain $P(Z<-1.67)=0.0475$. Therefore}
P(175<X<225)&=0.9525-0.0475\\
&=0.9050.
\end{align*}

\item [(d)] If a 240ml cup is used then it will overflow with probability
$P(X>240)$. Now $P(X>240)=1-P(X\leq 240)$. Also
\[
z=\dfrac{240-\mu}{\sigma}=\dfrac{240-200}{15}=2.6667
\]
and from tables we obtain $P(Z<2.67)=0.9962$. Therefore
\[
P(X>240)=1-0.9962=0.0038.
\]
Hence, with 10000 drinks we would expect $10000\times 0.0038=3.8$ to
overflow.

\end{itemize}

\newpage

\item [\textbf{2.}]  Let $X$ denote the time taken to deliver the goods. Then $X$ has a
normal distribution with mean $\mu=16\text{ days}$ and standard
deviation $\sigma=2.5\text{ days}$.
\begin{itemize}
\item [(a)] The probability of a delivery being late is $P(X>20)$. Now
$P(X>20)=1-P(X\leq 20)$. Also
\[
z=\dfrac{20-\mu}{\sigma}=\dfrac{20-16}{2.5}=1.6
\]
and from tables we obtain $P(Z<1.6)=0.9452$. Therefore
\[
P(X>20)=1-0.9452=0.0548.
\]

\item [(b)] The probability that customers receive their orders between 10 and
15 days is
\begin{align*}
P(10<X<15)
&=P(X<15)-P(X\leq 10).
\intertext{Now}
z&=\dfrac{15-\mu}{\sigma}=\dfrac{15-16}{2.5}=-0.4
\intertext{and from tables we obtain $P(Z<-0.4)=0.3446$, and so
$P(X<15)=0.3446$. Also}
z&=\dfrac{10-\mu}{\sigma}=\dfrac{10-16}{2.5}=-2.4
\intertext{and from tables we obtain $P(Z<-2.4)=0.0082$, and so
$P(X\leq 10)=0.0082$. Therefore}
P(10<X<15)&=0.3446-0.0082\\
&=0.3364.
\end{align*}

\item [(c)] If only 3\% of deliveries are late then we need the number of days
$x$ so that $P(X\leq x)=0.97$. First, we need the value of $z$ so that
$P(Z<z)=0.97$. Using tables, the two key probabilities are
\[
P(Z<1.88)=0.9699\quad\text{and}\quad P(Z<1.89)=0.9706
\]
and so we take $z=0.9699$.  
\\
\\
\noindent In other words $P(Z<1.88)\approx 0.97$. Moving back to the delivery time
scale, we need the value $x$ such that $P(X<x)=0.97$ and so we take
\begin{align*}
x&=\mu+z\sigma\\
&=16+1.88\times 2.5\\
&=20.7\text{ days}.
\end{align*}

\item [(d)] In the new processing system, $X$ has a normal distribution with
mean $\mu=16\text{ days}$ and standard deviation $\sigma=1.5\text{
days}$. The probability of a delivery on time is $P(X<20)$. Now
\[
z=\dfrac{20-\mu}{\sigma}=\dfrac{20-16}{1.5}=2.6667
\]
and from tables we obtain $P(Z<2.67)=0.9962$. Therefore
\[
P(X<20)=0.9962.
\]
This is an increase on the previous system of over 5\%.

\end{itemize}

\item [\textbf{3.}] The amount of time (in minutes) that the coach is delayed $X$ has a
uniform distribution on $a=-15$ to $b=45$.

\begin{itemize}
\item [(a)] The pdf is a flat line, height $1/\{45-(-15)\}=1/60$, in the range
$-15$ to $45$. The pdf is zero everywhere else.

\resizebox{\textwidth}{!}{\includegraphics{coach.PS}}

\item[(b)] The mean of this distribution is
\begin{align*}
E(X)&=\frac{a+b}{2}=\frac{45+(-15)}{2}=15\text{ minutes},
\intertext{so that, on average, the coach is 15 minutes late. Also, the
variance is} 
Var(X)&=\frac{\{45-(-15)\}^2}{12}=\frac{3600}{12}=300
\end{align*}
and therefore $SD(X)=\sqrt{Var(X)}=\sqrt{300}=17.32$ minutes.

\item [(c)] Probabilities for this distribution are calculated using
\begin{align*}
P(X\leq x)
&= 
\begin{cases}
0&\text{for }x<a\\
\dfrac{x-a}{b-a}&\text{for }a\leq x \leq b\\
1 &\text{for }x>b
\end{cases}\\ \\
&= 
\begin{cases}
0&\text{for }x<-15\\
\dfrac{x+15}{60}&\text{for }-15\leq x \leq 45\\
1 &\text{for }x>45.
\end{cases}
\end{align*}

 The probability that the coach is less than 5 minutes late is
\[
P(X<5)=\dfrac{5+15}{60}=\dfrac{20}{60}
=\dfrac{1}{3}=0.3333.
\]

\item [(d)]  The probability that the coach is more than 20 minutes late is
\[
P(X>20)=1-P(X\leq 20)=1-\dfrac{20+15}{60}=1-\dfrac{35}{60}
=\dfrac{5}{12}=0.4167.
\]

\item [(e)] The probability that the coach arrives between 22.55 and 23.20 is
\begin{align*}
P(-5<X<20)&=P(X<20)-P(X\leq -5)\\
&=\dfrac{20+15}{60}-\dfrac{-5+15}{60}\\
&=\dfrac{35}{60}-\dfrac{10}{60}\\
&=0.4167.
\end{align*}

\item [(f)] The probability that the coach arrives at 23.00 depends on what is
meant by ``arrives at 23.00''. If it has a strict meaning, that is,
the coach arrives at exactly 23.00 (not even a billionth of a second
out) then this event has probability zero. However, if this
description means ``to the nearest minute'' then we need the
probability that the coach arrives at 23.00 plus or minus half a
minute. In terms of the random variable $X$, this probability is
\begin{align*}
P(-0.5<X<0.5)&=P(X<0.5)-P(X\leq -0.5)\\
&=\dfrac{0.5+15}{60}-\dfrac{-0.5+15}{60}\\
&=\dfrac{15.5}{60}-\dfrac{14.5}{60}\\
&=\dfrac{1}{60}\\
&=0.0167.
\end{align*}

\item [(g)] The question states that the coach cannot arrive more than 45
minutes late and so the probability it arrives at 0.00 is zero.

\item [(h)] It does not seem very realistic to have sharp cutoffs at -15 and 45 minutes late. It would seem more realistic to let the probability density decrease gradually in both directions.
\end{itemize}

\vspace{0.5cm}

\item [\textbf{4.}]  As the network server receives incoming requests according to a
Poisson process with mean $\lambda=2.5$ per minute, the time between
successive requests $X$ has an exponential distribution with parameter
$\lambda=2.5$ per minute.

\begin{itemize}
\item [(a)] The expected time between arrivals of requests is
\[
E(X)=\frac{1}{\lambda}=\frac{1}{2.5}=0.4\text{ minutes}.
\]

\item [(b)] Probabilities for this distribution are calculated using
\begin{align*}
P(X\leq x)&=
\begin{cases}
0&\text{for }x<0\\
1-e^{- \lambda x}& \text{for }x>0
\end{cases}\\ \\
&=\begin{cases}
0&\text{for }x<0\\
1-e^{-2.5\times x}& \text{for }x>0.
\end{cases}
\end{align*}

 The probability that the time between requests is less than 2
minutes is
\[
P(X<2)=1-e^{-2.5\times 2}=1-e^{-5}=1-0.0067=0.9933.
\]

\item [(c)] The probability that the time between requests is greater than 1
minute is
\[
P(X>1)=1-P(X<1)=1-\left(1-e^{-2.5\times 1}\right)=e^{-2.5}=0.0821.
\]

\item [(d)]  The probability that the time between requests is between 30
seconds and 50 seconds is
\begin{align*}
P\left(\frac{1}{2}<X<\frac{5}{6}\right)
&=P\left(X<\frac{5}{6}\right)-P\left(X\leq\frac{1}{2}\right)\\
&=1-e^{-2.5\times 5/6}-\left(1-e^{-2.5\times 1/2}\right)\\
&=e^{-1.25}-e^{-12.5/6}\\
&=0.2865-0.1245\\
&=0.1620.
\end{align*}
\end{itemize}

\vspace{0.5cm}

\item [\textbf{5.}] Let $X$ denote the time to first breakdown. Then

Company 1: $X$ has an exponential distribution with
$\lambda=0.11$. Therefore, the probability of no breakdown within the
first six months is
\[
P(X>6)=1-P(X<6)=1-\left(1-e^{-0.11\times 6}\right)=e^{-0.66}=0.5169.
\]

Company 2: $X$ has an exponential distribution with
$\lambda=0.01$. Therefore, the probability of no breakdown within the
first six months is
\[
P(X>6)=1-P(X<6)=1-\left(1-e^{-0.01\times 6}\right)=e^{-0.06}=0.9418.
\]

On the basis of this calculation alone, recommend buy from Company 2 as their probability of no breakdown
within the first six months is much larger than that of Company~1.

To take into account a difference in price you might consider the cost to the company of a breakdown within six months and compare the expected monetary values of the two possible decisions.

\newpage

\item [\textbf{6.}] 
\begin{itemize}
\item [(a)] $X \sim Po(10)$; $E[X] = Var(X) = 10$, and so $SD(X) = \sqrt{10}$.
\item [(b)] $Y \sim Exp(10)$; $E[Y] = SD(X) = 1/10 = 0.1$.
\item [(c)] 
\begin{eqnarray*}
P(X\leq 3) &=& P(X=0) + P(X=1) + P(X=2) + P(X=3) \\
           &=& e^{-10} + 10 e^{-10} + \frac{10^2e^{-10}}{2} + \frac{10^3e^{-10}}{3!} \\
           &=&0.0103.
\end{eqnarray*}

\item [(d)] 
\begin{eqnarray*}
P\left(Y \geq \frac{1}{6}\right) &=& 1-P\left(Y\leq \frac{1}{6}\right) \\
                      &=&1-\left(1-e^{-10 \times (1/6)}\right) \\
                      &=&0.189.
\end{eqnarray*}

\item [(e)] First of all, $P(X<4) = P(X\leq 3) = 0.0103$, from part (a).  

  Now let $Z$: number of branches receiving a bonus.  We have
\[
Z \sim \textrm{Bin}(20, 0.0103),
\]
giving
\begin{eqnarray*}
P(Z<2)   &=& P(Z=0) + P(Z=1) \\
         &=&\comb{20}{0}\times 0.0103^{0}\times 0.9897^{20}+\comb{20}{1}\times 0.0103^{1} \times 0.9897^{19} \\
         &=&  0.9822. 
\end{eqnarray*}

\item [(f)]  Let $S$: weekly sales (in pounds).  Then
\[
P(S>7550+(2\times 255))   = P(S>8060).
\]
Standardising, we get:
\[
P\left(Z>\frac{8060-7550}{255}\right)  = 1-P(Z\leq 2) = 1-0.0228 = 0.9772.
\]
\end{itemize}

\vspace{0.5cm}

\item [\textbf{7.}] For the ``before'' period, we have
\[
P(X>35) = 1-P\left(Z<\frac{35-21.3}{5.1}\right) = 1-P(Z<2.69) = 0.0036.
\]
For the ``after'' period, we have
\[
P(X>35) = 1-P\left(Z<\frac{35-24.9}{4.8}\right)= 1-P(Z<2.10) = 0.0179.
\]

\vspace{0.5cm}

\item [\textbf{8.}] We have $T \sim Exp(9)$.  
\[
P\left(T<\frac{1}{6}\right) = 1-e^{-9\times (1/6)} = 0.777.
\]

\end{itemize}

\newpage

\begin{center}
\LARGE
\textbf{Solutions to practice questions: Chapter 6}
\end{center}
\normalsize

\begin{itemize}
\item[\textbf{1.}]\noindent We use the formulae
\begin{eqnarray*}
\bar{x} &\pm& 1.96 \times \sqrt{\sigma^{2}/n}	\qquad \textrm{and} \\
\bar{x} &\pm& 2.58 \times \sqrt{\sigma^{2}/n}
\end{eqnarray*}
to calculate the 95\% and 99\% confidence intervals (respectively).  Now we know that 
\begin{eqnarray*}
\bar{x} &=& 750\textrm{g},	\\
\sigma^{2}   &=& 100 \qquad \textrm{and}	\\
n   	     &=& 50.
\end{eqnarray*}
Thus, the 95\% confidence interval for $\mu$ is found as
\begin{eqnarray*}
750 &\pm& 1.96 \times \sqrt{100/50}	\qquad \textrm{i.e.}\\
750 &\pm& 1.96 \times \sqrt{2}		\qquad \textrm{i.e.}\\
750 &\pm& 2.771859.
\end{eqnarray*}
So, the 95\% confidence interval for $\mu$ is (747.228g, 752.772g).  
\\
\\
\noindent Similarly, the 99\% confidence interval for $\mu$ is found as
\begin{eqnarray*}
750 &\pm& 2.58 \times \sqrt{100/50}	\qquad \textrm{i.e.}\\
750 &\pm& 2.58 \times \sqrt{2}		\qquad \textrm{i.e.}\\
750 &\pm& 3.648671.
\end{eqnarray*}
So the 99\% confidence interval for $\mu$ is (746.351g, 753.649g).

\item [\textbf{2.}]  The 95\% confidence interval is found as
\begin{eqnarray*}
\bar{x} &\pm& t \times \sqrt{s^{2}/n},
\end{eqnarray*}
as here we have the \textit{sample} variance/standard deviation.  Since $n>30$, we use the $\infty$ row in the $t$--table on page 156, giving $t=1.96$.  Thus, we have
\begin{eqnarray*}
98 &\pm& 1.96 \times \sqrt{50/100}	\qquad \textrm{i.e.}	\\
98 &\pm& 1.96 \times \sqrt{0.5}	\qquad \textrm{i.e.}	\\
98 &\pm& 1.385929.
\end{eqnarray*}
Thus, the 95\% confidence interval for $\mu$ is (96.614mm, 99.386mm).
\\
\\
\noindent Since the confidence interval does not cover the target value of 100mm, we can say that the process is \textit{not} satisfactory.    

\newpage

\item [\textbf{3.}]  The 95\% and 99\% confidence intervals are given by 
\begin{eqnarray*}
\bar{x} &\pm & t \times \sqrt{s^{2}/n},
\end{eqnarray*}
where $t=2.201$ and $z=3.106$ for a 95\% and a 99\% confidence interval (respectively; see table on page 156).  Thus, we have:
\[
110 \pm 2.201 \times \sqrt{220/12} \longrightarrow (100.58, 119.42)
\]
for our 95\% interval, and
\[
110 \pm 3.106 \times \sqrt{220/12} \longrightarrow (96.70, 123.30)
\]
for our 99\% interval.  
\\
\\
\noindent Only the 99\% confidence interval captures the known population mean IQ of 100.  

\item [\textbf{4.}]  Calculating a 95\% confidence interval gives
\[
240 \pm 1.96 \times \sqrt{400/100} \longrightarrow (236.08\textrm{ml}, 243.92\textrm{ml}).
\]
Since this does not capture the target value, this is \textit{not} consistent with the cans containing the stated weight.  

\item [\textbf{5.}]  \noindent First of all, we set up our null and alternative hypotheses, which are
\begin{eqnarray*}
H_{0}	&:& \mu=250	\qquad \textrm{versus}	\\
H_{1}	&:& \mu \neq 250.
\end{eqnarray*}
\noindent We now calculate the test statistic.  Since the process variance is \textit{known}, the test statistic is found using
\begin{eqnarray*}
z &=& \frac{|\overline{x}-\mu|}{\sqrt{\sigma^{2}/n}}	\qquad \textrm{i.e.}\\
z &=& \frac{|240 - 250|}{\sqrt{400/100}}	\\
  &=& \frac{10}{\sqrt{4}}	\\
  &=& \frac{10}{2}	\\
  &=& 5.  
\end{eqnarray*}  
\noindent To obtain our $p$--value, we use standard normal distribution tables (since the population variance is know in this case).  Thus, referring to tables, we have:
\begin{center}
\begin{tabular}{|c| c c c|} \hline
Significance level	&10\%		&5\%		&1\%		\\ \hline
Critical value		&1.645		&1.96		&2.576		\\ \hline
\end{tabular}
\end{center}
\noindent Since our test statistic of $z=5$ lies to the right--hand--side of the last critical value of 2.576, then our $p$--value is smaller than 1\%.  
\\
\\
\noindent In conclusion, we have strong evidence against the null hypothesis (using table 6.2 to interpret our $p$--value).  Thus we reject $H_{0}$ in favour of the laternative $H_{1}$;  it appears that the population mean is \textit{not} equal to 250ml, i.e. the filling machine is \textit{not} consistent with the stated weight of 250ml.

\item [\textbf{6.}] Very similar to example 6.4 in the lecture notes -- see your solutions to this! Brief answers:
\begin{eqnarray*}
H_{0}&:& \mu_{1}=\mu_{2} \\
H_{1}&:& \mu_{1}>\mu_{2}
\end{eqnarray*}
Pooled standard deviation is 
\[
s = \sqrt{\frac{(17\times 100000)+(11\times 95000)}{28}} = 313.1066;
\]
Thus,
\[
t = \frac{|15000-14750|}{313.1066\times \sqrt{1/18+1/12}} = 4.285.
\]
From $t$--tables, on $\nu=n_{1}+n_{2}-2=28$ degrees of freedom, (and for a one--tailed test) we get
\begin{center}
\begin{tabular}{|c|c c c|}  \hline
$p$--value     &10\%   &5\%    &1\% \\ \hline
critical value &1.313 &1.701   &2.467 \\ \hline
\end{tabular}
\end{center}
Thus, our $p$--value is less than 1\%.  Conclusions:
\begin{itemize}
\item Strong evidence against $H_{0}$
\item Reject $H_{0}$ in favour of $H_{1}$
\item There is sufficient evidence to sugget that store 1 \textit{is} more successful!
\end{itemize}

\item [\textbf{7.}] \begin{itemize}
\item [(a)]  This is a one--sample test, as we are comparing the mean flight time of EasyAir's flights between Glasgow and Cairo with an advertised value (5 hours = 300 minutes).  Thus, the null hypothesis is
\begin{eqnarray*}
H_{0} &:& \mu = 300 \textrm{ mins}.
\end{eqnarray*}
\noindent Since the rival company, RyanJet, suspect EasyAir of false advertising, we might want to test the one--tailed alternative
\begin{eqnarray*}
H_{1} &:& \mu > 300 \textrm{ mins}.
\end{eqnarray*}
\noindent Since the population variance is unknown, the test statistic is 
\begin{eqnarray*}
t &=& \frac{|\bar{x}-\mu|}{\sqrt{s^{2}/n}}	\\
  &=& \frac{|310 - 300|}{\sqrt{20^{2}/20}}	\\
  &=& \frac{10}{\sqrt{400/20}}	\\
  &=& \frac{10}{4.472}	\\
  &=& 2.236.  
\end{eqnarray*}
\noindent We use $t$--tables to obtain our $p$--value for this hypothesis test.  Now $\nu=n-1=20-1=19$, and using this, from $t$--tables in the notes, we get:
\begin{center}
\begin{tabular}{|c| c c c|} \hline
Significance level		&10\%		&5\%	&1\%	\\ \hline
Critical value			&1.328		&1.729	&2.539	\\ \hline
\end{tabular}
\end{center}
\noindent Our test statistic $t=2.236$ lies between the two critical values of 1.729 and 2.539, and so our $p$--value lies between 1\% and 5\%.  
\\
\\
\noindent We conclude that there is moderate evidence against the null hypothesis, and so we reject $H_{0}$ and accept the alternative $H_{1}$; it appears that EasyAir's flights are, on average, longer than the advertised time of 5 hours (or 300 minutes) between Glasgow and Cairo.  So RyanJet's suspicions \textit{are} supported!

\item [(b)]  We now want to compare the average flight time of RyanJet's flights with EasyAir's on this route.  To summarise, we have

\begin{center}
\begin{tabular}{c c} \hline  
EasyAir			&RyanJet		\\ \hline
$n_{1}=20$		&$n_{2}=23$			\\
$\bar{x}_{1}=310$	&$\bar{x}_{2}=304$	\\
$s_{1}=20$		&$s_{2}=22$		\\ \hline
\end{tabular}
\end{center}

\noindent Remember -- for a two--sample test, our null hypothesis is
\begin{eqnarray*}
H_{0} &:& \mu_{1} = \mu_{2},
\end{eqnarray*}
\noindent i.e. there's no difference between the population mean flight times of the two airlines.  Since the question says ``Are RyanJet's flights shorter than EasyAir's?'', we need to test the one--tailed alternative hypothesis
\begin{eqnarray*}
H_{1} &:& \mu_{1}>\mu_{2}
\end{eqnarray*}
(i.e. EasyAir's are longer).  
\\
\\
\noindent Since the population variances are unknown, we use the test statistic
\begin{eqnarray*}
t &=& \frac{|\bar{x}_{1}-\bar{x}_{2}|}{s \times \sqrt{\frac{1}{n_{1}}+\frac{1}{n_{2}}}}, \qquad \textrm{i.e.}	\\
t &=& \frac{|310-304|}{s \times \sqrt{\frac{1}{20}+\frac{1}{23}}}	\\
  &=& \frac{6}{s \times 0.306}.
\end{eqnarray*}
\noindent Now remember that $s$ is the ``pooled standard deviation'', and is equal to
\begin{eqnarray*}
s &=& \sqrt{\frac{(n_{1}-1)s_{1}^{2} + (n_{2}-1)s_{2}^{2}}{n_{1}+n_{2}-2}}.
\end{eqnarray*}
\noindent Note that the calculation of $s$ requires $s_{1}^{2}$ and $s_{2}^{2}$, i.e. the sample \textit{variances}.  What we have are the sample \textit{standard deviations}.  Thus
\begin{eqnarray*}
s_{1}^{2} &=& 20 \times 20	\\
	  &=& 400,
\end{eqnarray*}
\noindent and
\begin{eqnarray*}
s_{2}^{2} &=& 22 \times 22	\\
	  &=& 484.  
\end{eqnarray*}
\noindent Thus,
\begin{eqnarray*}
s &=& \sqrt{\frac{19 \times 400 + 22 \times 484}{20+23-2}}	\\
  &=& \sqrt{\frac{18248}{41}}		\\
  &=& \sqrt{445.073}	\\
  &=& 21.097.
\end{eqnarray*}
So now we can calculate $t$!
\begin{eqnarray*}
t &=& \frac{6}{21.097 \times 0.306}	\\
  &=& \frac{6}{6.456}	\\
  &=& 0.929.
\end{eqnarray*} 
\noindent Since the population variances are unknown, we need to use $t$ tables (lecture notes) to obtain our $p$--value.  The degrees of freedom, $\nu = n_{1}+n_{2}-2 = 20+23-2 = 41$.  Looking at $t$--tables in the notes, we see that the degrees of freedom only goes up to 29; thus, since we have a large sample size, we use the ``infinity'' (or $\infty$) row of the table.  This gives the following values:
\begin{center}
\begin{tabular}{|c|c c c|} \hline
Significance level	&10\%		&5\%		&1\%	\\ \hline
Critical value		&1.282		&1.645		&2.326	\\ \hline
\end{tabular}
\end{center}  
\noindent Since our test statistic $t=0.929$ lies to the left of the above table, our $p$--value is bigger than 10\%.  
\\
\\
\noindent We can conclude that there is no evidence against the null hypothesis, and so we should \textit{retain} $H_{0}$.  It appears that, on average, there is no significant difference between the flight times of EasyAir and RyanJet between Glasgow and Cairo.  
\end{itemize}

\item [\textbf{8.}] This is one--sample test, as we are comparing the mean of a single sample with a hypothesised value.  Our null hypothesis is
\begin{eqnarray*}
H_{0} &:& \mu=19.5.
\end{eqnarray*}
Since the question wants us to find out if younger students are favoured, we test the null hypothesis against the one--tailed alternative
\begin{eqnarray*}
H_{1} &:& \mu < 19.5.
\end{eqnarray*}
\\
\\
\noindent Since the population variance is unknown, we use the test statistic is
\begin{eqnarray*}
t &=& \frac{|\overline{x}-\mu|}{\sqrt{s^{2}/n}}.
\end{eqnarray*}
\noindent Now in this example, $\bar{x}$ and $s^{2}$ aren't given, so we have to find the mean and variance by hand (or use a calculator!).  Thus,
\begin{eqnarray*}
\overline{x} &=& \frac{17.9 + 18.2 + \ldots + 17.8}{7}	\\
	     &=& 18.36;
\end{eqnarray*}
similarly,
\begin{eqnarray*}
s^{2} &=& \frac{(17.9-18.36)^{2}+(18.2-18.36)^{2} + \ldots + (17.8-18.36)^{2}}{6}	\\
      &=& 1.02.
\end{eqnarray*}
So the test statistic is
\begin{eqnarray*}
t &=& \frac{|18.36-19.5|}{\sqrt{1.02/7}}	\\
  &=& \frac{1.14}{0.382}	\\
  &=& 2.98.  
\end{eqnarray*}

\noindent Since the population variance is unknown, we must use tables of values for the $t$--distribution to obtain our $p$--value.  The degrees of freedom, $\nu=n-1 = 7-1=6$; thus, the critical values are:
\begin{center}
\begin{tabular}{|c| c c c|} \hline
Significance level		&10\%		&5\%	&1\%	\\ \hline
Critical value			&1.440		&1.943	&3.143	\\ \hline
\end{tabular}
\end{center}
\noindent Our test statistic, $t=2.98$, lies in between the critical values 1.943 and 3.143, and so our $p$--value lies between 1\% and 5\%.    
\\
\\
\noindent We conclude that there is moderate evidence against the null hypothesis, and so we reject $H_{0}$ in favour of $H_{1}$.  It appears that, on average, younger students \textit{are} being favoured. 

\item [\textbf{9.}]  This is a two--sample test.  Our null hypothesis is
\begin{eqnarray*}
H_{0} &:& \mu_{1} = \mu_{2},
\end{eqnarray*}
where the subscripts 1 and 2 denote streakers and non--streakers (respectively).  Since the question states ``are streakers more extrovert than non--streakers?'', we test against the one--tailed alternative
\begin{eqnarray*}
H_{1} &:& \mu_{1}>\mu_{2}.
\end{eqnarray*}
\noindent Since neither population variance is known, we use the test statistic
\begin{eqnarray*}
t &=& \frac{|\bar{x}_{1}-\bar{x}_{2}|}{s \times \sqrt{\frac{1}{n_{1}}+\frac{1}{n_{2}}}}, \qquad \textrm{i.e.}	\\
t &=& \frac{|15.26-13.90|}{s \times \sqrt{\frac{1}{19}+\frac{1}{19}}}	\\
  &=& \frac{1.36}{s \times 0.324}.
\end{eqnarray*}
\noindent Now remember that $s$ is the ``pooled standard deviation'', and is equal to
\begin{eqnarray*}
s &=& \sqrt{\frac{(n_{1}-1)s_{1}^{2} + (n_{2}-1)s_{2}^{2}}{n_{1}+n_{2}-2}}\\
  &=& \sqrt{\frac{18 \times 2.62 + 18\times 4.11}{19+19-2}}	\\
  &=& \sqrt{\frac{47.16 + 73.98}{36}}	\\
  &=& 1.834.
\end{eqnarray*} 
Hence
\begin{eqnarray*}
t &=& \frac{1.36}{1.834 \times 0.324}	\\
  &=& 2.289.
\end{eqnarray*} 
\noindent Since neither population variances are known, we use $t$--tables to obtain our $p$--value.  the degrees of freedom $\nu = 19+19-2 = 36$.  As before, you should notice that table 2.3 only goes down to $\nu=29$, and so we use the $\infty$ row.  Doing so gives the following values:
\begin{center}
\begin{tabular}{|c| c c c|} \hline
Significance level 		&10\%		&5\%		&1\%	\\ \hline
Critical value			&1.282		&1.645		&2.326	\\ \hline
\end{tabular}
\end{center}
\noindent Our test statistic $t=2.289$ lies in between the critical values 1.645 and 2.326, and so our $p$--value lies between 1\% and 5\%.  
\\
\\ 
\noindent We conclude that there is moderate evidence against the null hypothesis, and so we should reject $H_{0}$ in favour of $H_{1}$; it appears that, on average, streakers \textit{are} more extrovert than non--streakers. 

\item [\textbf{10.}]  This is a two--sample test -- we want to compare the average coverage of two types of paint.  Our null hypothesis is
\begin{eqnarray*}
H_{0} &:& \mu_{1} = \mu_{2},
\end{eqnarray*}
that is, there is no difference in the mean coverage of each type of paint.  Since the question doesn't ask us to determine which brand of paint has the most or least coverage, we use a general, two--sided alternative, i.e.
\begin{eqnarray*}
H_{1} &:& \mu_{1} \neq \mu_{2}.
\end{eqnarray*}
\noindent In this question, the population standard deviations are both \textit{known}; For ``Wilko's Best'', we have $\sigma_{1}=31$ and for ``Dulor'' we have $\sigma_{2}=26$.  Thus, the population \textit{variances} are $\sigma_{1}^{2}=31\times 31 = 961$ and $\sigma_{2}^{2} = 26 \times 26 = 676$.  
\\
\\
\noindent The test statistic is
\begin{eqnarray*}
z &=& \frac{|\bar{x}_{1}-\bar{x}_{2}|}{\sqrt{\frac{\sigma_{1}^{2}}{n_{1}}+\frac{\sigma_{2}^{2}}{n_{2}}}}.  
\end{eqnarray*}
\noindent Now we don't know the sample means; however, we can calculate these from the data.  For ``Wilko's Best'', we have
\begin{eqnarray*}
\bar{x}_{1} &=& 545.5;
\end{eqnarray*}
similarly, for ``Dulor'', we have
\begin{eqnarray*}
\bar{x}_{2}	&=& 521.
\end{eqnarray*}
\noindent Thus,
\begin{eqnarray*}
z	&=& \frac{|545.5-521|}{\sqrt{\frac{961}{8}+\frac{676}{10}}}	\\
    	&=& \frac{24.5}{13.701}	\\
 	&=& 1.788.
\end{eqnarray*}
\noindent We use standard normal tables to obtain our $p$--value.  For a two--tailed test, this gives:
\begin{center}
\begin{tabular}{|c| c c c|} \hline
Significance level 	&10\%	&5\%		&1\%		 \\ \hline
Critical value		&1.645	&1.96		&2.576		\\ \hline
\end{tabular}
\end{center}
\noindent Since our test statistic $z=1.788$ lies in between the critical values 1.645 and 1.96, our $p$--value lies between 5\% and 10\%.  
\\
\\
\noindent In conclusion, we can say that there is only \textit{slight} evidence against the null hypothesis, and so we should \textit{retain} $H_{0}$.  It appears that, on average, both brands of paint give the same coverage.  
\end{itemize}



\newpage

\begin{center}
\LARGE
\textbf{Solutions to practice questions: Chapter 7}
\end{center}
\normalsize

\begin{itemize}
\item[\textbf{1.}] \begin{itemize}
\item [(a)] The scatter plot for advertising and sales has been constructed in \texttt{Minitab}, and is shown below; yours (done by hand) should look similar to this!  Notice how ``sales'' is on the $y$--axis, since this is the response variable -- we're probably going to be interested in predicting sales based on the amount spent on advertising.  From this plot, we can see that there is quite a strong, linear, positive relationship between the amount spent on advertising and the amount brought in through sales, i.e. the more the company spends on advertising, the more money they are likely to make! 
\begin{center}
\includegraphics[width=6in, height=4.5in]{sol6plot1.eps}
\end{center}
\item [(b)] Recall that the sample correlation coefficient, $r$, is found as
\begin{eqnarray*}
r&=& \frac{S_{xy}}{\sqrt{S_{xx}\times S_{yy}}},
\end{eqnarray*}
where
\begin{eqnarray*}
S_{xy} &=& \left(\sum xy \right)-n\bar{x}\bar{y},	\\
S_{xx}	&=& \left(\sum x^{2}\right)-n \bar{x}^{2},		\\
S_{yy}	&=& \left(\sum y^{2}\right)-n \bar{y}^{2}.
\end{eqnarray*}

\newpage

\noindent We can draw up the following table to help:

\begin{center}
\begin{tabular}{|c| c| c| c| c| } \hline
$x$		&$y$		&$x^{2}$	&$y^{2}$	&$xy$	\\ \hline
100		&11.2		&10000		&125.44		&1120	\\
90		&12.1		&8100		&146.41		&1089	\\
110		&13.2		&12100		&174.24		&1452	\\
120		&15.1		&14400		&228.01		&1812	\\
115		&14.2		&13225		&201.64		&1633	\\
95		&10.2		&9025		&104.04		&969	\\
105		&12.5		&11025		&156.25		&1312.5	\\
130		&16.6		&16900		&275.56		&2158	\\
118		&14.8		&13924		&219.04		&1746.4	\\
100		&10.8		&10000		&116.64		&1080	\\
115		&11.2		&13225		&125.44		&1288	\\
128		&15.9		&16384		&252.81		&2035.2 \\ \hline
1326		&157.8		&148308		&2125.52	&17695.1 \\ \hline 		
\end{tabular}
\end{center}
\noindent Using the information in the above table,
\begin{eqnarray*}
\bar{x}	&=& \frac{1326}{12}	\\
	& &			\\
	&=&110.5,\\
	& &	\\
\bar{y}	&=&\frac{157.8}{12}	\\
	& &	\\
	&=& 13.15.
\end{eqnarray*}
\noindent Thus,
\begin{eqnarray*}
S_{xy}	&=& \left(\sum xy \right) - n\times \bar{x} \times \bar{y}	\\
	&=& 17695.1 - 12\times 110.5\times13.15	\\
	&=& 258.2,\\
	& &	\\
S_{xx}	&=& \left(\sum x^{2} \right) - n \times \bar{x}^{2}	\\
	&=& 148308 - 12 \times 110.5\times 110.5	\\
	&=& 1785		\qquad \textrm{and}	\\
	& &	\\
S_{yy}	&=&\left(\sum y^{2} \right) - n \times \bar{y}^{2}	\\
	&=& 2125.52 - 12 \times 13.15 \times 13.15		\\
	&=& 50.45.
\end{eqnarray*}
So the sample correlation coefficient is
\begin{eqnarray*}
r	&=& \frac{S_{xy}}{\sqrt{S_{xx}\times S_{yy}}}	\\
	&=&\frac{258.2}{\sqrt{1785 \times 50.45}}	\\
	& &	\\
	&=& 0.8604 \textrm{ (to 4 decimal places)}.
\end{eqnarray*}
\noindent Our sample correlation coefficient is $r=0.8604$, which indicates quite a strong, positive, linear association between amount spent on advertising and sales.  This \textit{does} agree with the scatter plot in part (a); the plot shows sales increasing with amount spent on advertising, and indicates a strong, positive, linear relationship between the two!

\item [(c)]The simple linear regression model is given by
\begin{eqnarray*}
Y&=& \alpha + \beta X + \epsilon,
\end{eqnarray*}
where we can estimate $\alpha$ and $\beta$ using
\begin{eqnarray*}
\hat{\beta}	&=&\frac{S_{xy}}{S_{xx}}	\qquad \textrm{and}	\\
\hat{\alpha}	&=&\bar{y} -\hat{\beta}\bar{x}.
\end{eqnarray*}
\noindent Thus,
\begin{eqnarray*}
\hat{\beta}	&=&\frac{258.2}{1785}	\\
		&&	\\
		&=&	0.1446,		\qquad \textrm{and}	\\
		&&	\\
\hat{\alpha}	&=& 13.15 - 0.1446\times 110.5	\\
		&=&-2.8283.
\end{eqnarray*}
\noindent Thus, the estimated linear regression equation is
\begin{eqnarray*}
Y &=& -2.8283 +0.1446X + \epsilon.
\end{eqnarray*}

\item [(d)]The regression line has been superimposed on the original scatter plot, and is shown below.  Remember, to do this, just pick two arbitrary $X$ values and use your estimated regression equation to find the corresponding $Y$ values.  Then all you have to do is plot the two points and join up the line! 
\\
\\
\noindent For example, $X=100$ and $X=110$: 
\begin{itemize}
\item [--] when $X=100$, $Y=-2.8283+0.1446\times 100 = 11.63$;
\item [--] when $X=110$, $Y=-2.8283+0.1446\times 110 = 13.08$.
\end{itemize}
\noindent So all you have to do now is plot the points $(100,11.63)$ and $(110, 13.08)$, and join them up with a straight line! (see overleaf) 
\item [(e)] If the company were to spend $\pounds 112,000$, we can expect their sales to be
\begin{eqnarray*}
Y	&=& -2.8283 +0.1446 \times 112	\\
	&=&13.4,
\end{eqnarray*}
\noindent i.e. $\pounds 13.4$ million.

\begin{center}
\includegraphics[width=5in, height=3.5in]{sol6plot2.eps}
\end{center}

\end{itemize}

\item [\textbf{2.}] This question is very similar (but easier/less work to do!) than question 1.  Thus, solutions will be more brief.  
\begin{itemize}
\item [(a)] Graph should show a fairly strong, positive, linear association.
\item [(b)] You should be able to find that
\begin{eqnarray*}
S_{xx} &=&153572.5 \\
S_{yy}  &=&594.9 \\
S_{xy}  &=&8775.5
\end{eqnarray*}
Thus
\begin{itemize}
\item [(i)] 
\[
r = \frac{8775.5}{\sqrt{153572.5 \times 594.5}} =0.918.
\]
\item[(ii)]
\begin{eqnarray*}
\hat{\beta}_{1}  &=& \frac{8775.5}{153572.5} = 0.057 \qquad \textrm{and} \\
&& \\
\hat{\beta}_{0}   &=&\frac{229}{10} - 0.057\times \frac{2705}{10} = 7.482.
\end{eqnarray*}
Thus, we have
\[
y = 7.482+0.057x + \epsilon,
\]
and this line can be plotted in the same way we plotted our line in question 1.
\end{itemize}

\item [(c)] For Mr. Adams, $x=375$.  Thus,
\[
y = 7.482+0.057\times 375 = 28.857\textrm{ days},
\]
meaning that Mr. Adams probably \textit{won't} incur the late payment charge.

\item [(d)] The size of Miss Bloggs' electricity bill lies beyond the range of our data -- we cannot be certain that the linear association we have established will continue.  

\end{itemize}

\newpage

\item [\textbf{3.}]\begin{itemize}
\item [(a)] $x_{4}$ -- indicates the presence of a foodhall.
\item [(b)]
\begin{itemize}
\item [(i)] $y=82.93+2.894x_{1}-2.232x_{2}+13.1891x_{3}+9.182x_{4}$
\item [(ii)] We should remove variable $x_{2}$, as $\beta_{2}$ has the largest $p$--value.  Actually, we would retain:
\begin{eqnarray*}
H_{0}  &:&\beta_{1}=0 \qquad \textrm{and} \\
H_{0}  &:&\beta_{2}=0,
\end{eqnarray*}
since the $p$-values for \textit{both} $\beta_{1}$ \textit{and} $\beta_{2}$ are greater than 0.05; however, $\beta_{2}$ is the least significant as it's $p$--value is the largest.  We would reject both of
\begin{eqnarray*}
H_{0}   &:& \beta_{3}=0 \qquad \textrm{and} \\
H_{0}   &:&\beta_{4}=0.
\end{eqnarray*}
\end{itemize}

\item [(c)] 
\begin{itemize}
\item [(i)] From lectures, we know that
\[
\frac{\texttt{Coef}}{\texttt{SE Coef}} = \texttt{T}, 
\]
and so
\begin{eqnarray*}
\frac{\texttt{Coef}}{3.218}  &=&2.66 \\
             \texttt{Coef}   &=&2.66\times 3.218 \\
                       \texttt{Coef}  &=&8.5599
\end{eqnarray*}
Therefore
\[
y = 81.796+13.2602x_{3}+8.5599x_{4}.
\]
\item [(ii)]From the full model, we identified that variable $x_{2}$ should be removed.  The final model includes only $x_{3}$ and $x_{4}$, and so there must have been an intermediate fit which included $x_{1}$, $x_{3}$ and $x_{4}$ -- from which $x_{1}$ was found to be unimportant.  
\item [(iii)] Including $x_{4}$ in the model means that whether or not a store has a foodhall has an effect on weekly gross sales; in fact, a store with a foodhall has, on average, increased sales of about \pounds 8,560.  
\item [(iv)] The $R^{2}$ statistic has reduced from 96.2\% to $96.1\%$ -- so hardly any change at all, and a small pirce to pay for being able to exclude two variables!
\item [(v)] We have $x_{3}=5$ and $x_{4}=1$.  Thus
\[
y = 81.796+13.2602\times 5 + 8.5599\times 1 = 156.6569,
\]
i.e. \pounds 156,657.  
\end{itemize}

\end{itemize}
\end{itemize}

\end{document}

