# What's the best way to hide (leave space) for “Solution”?

Sorry if my previous question was not so clear. I will delete it later.

Here is a MVE.

\documentclass[12pt,a4paper]{report}

\usepackage{amsmath,amsthm,amssymb}
\usepackage{enumerate}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Example and Solution

\usepackage{thmtools}

\declaretheoremstyle[
spaceabove=6pt, spacebelow=6pt,
notefont=\mdseries, notebraces={(}{)},
bodyfont=\normalfont\itshape,
numberwithin=section
]{exstyle}
%
\declaretheoremstyle[
spaceabove=6pt, spacebelow=6pt,
notefont=\mdseries, notebraces={(}{)},
bodyfont=\normalfont,
qed=$\blacktriangleleft$,
numberwithin=section
%numbered=no
]{solstyle}
\declaretheorem[style=exstyle]{example}
\declaretheorem[style=solstyle]{solution}

\begin{document}
\chapter{ABCDEFGH}
\section{DDDDDDDDDDDDDDDDD}

\begin{example}
Cars pass a particular point at a rate of 5 cars per minute.
\begin{enumerate}[(a)]
\item Find the probability that exactly 4 cars pass the point in a minute.
\item Find the probability that between at least 3 but fewer than 8 cars pass in a particular minute.
\item Find the probability that more than 8 cars pass in 2 minutes.
\item Find the probability that more than 3 cars pass in each of two separate minutes.
\end{enumerate}

\begin{solution}
Let $X$ be the number of cars passing in a minute, then $X \sim \text{Po}(5)$.
\begin{enumerate}[(a)]
\item
$$P(X=4) = \frac{5^4\mathrm{e}^{-5}}{4!} \approx 0.175$$
\item
$$P(3 \leq X \leq 8) = P(X \leq 7) - P(X \leq 2) = 0.8666 - 0.1247 = 0.7419$$
\item
Poisson distribution assumes a constant rate of occurrence. So in two minutes' time, the rate would be 10. Let $Y$ be the number of cars passing in two minutes. Then $Y \sim \text{Po}(10)$, and
$$P(Y>8) = 1 - P(Y \leq 8) = 1 - 0.3328 = 0.6672$$
\item
For each one separate minute, we have
$$P(X>3) = 1 - P(X \leq 3) = 1 - 0.2650 = 0.7350.$$  \end{enumerate}
So the probability that more than 3 cars pass in each of two separate minutes is $$0.7350^2=0.540$$
to 3.s.f.
\end{solution}
\end{example}

\section{Mean and variance of the Poisson distribution}
We do the same trick as we did in Section~\ref{sec:binom-proof}.
\begin{align}
\operatorname{E}(X)
&= \sum_{x=0}^\infty x P(X=x) \\
&= \sum_{x=1}^\infty x \frac{\mu^x\mathrm{e}^{-\mu}}{x!} \\
&= \sum_{x=1}^\infty \frac{\mu^x\mathrm{e}^{-\mu}}{(x-1)!} \\
&= \mu \sum_{x=1}^\infty \frac{\mu^{x-1}\mathrm{e}^{-\mu}}{(x-1)!} \\
&= \mu \sum_{y=0}^\infty \frac{\mu^y\mathrm{e}^{-\mu}}{y!} \\
&= \mu.
\end{align}
The expectation of a Poisson distribution is the parameter $\mu$. \\

It can be shown that
$$\operatorname{E}(X(X-1)) = \mu^2,$$
it follows that
$$\operatorname{Var}(X) = \operatorname{E}[X(X-1)]+\operatorname{E}(X)-\operatorname{E}(X)^2 = \mu^2 + \mu - \mu^2 = \mu.$$
For a Poisson distribution, the mean equals the variance.

\begin{example}
In producing rolls of cloth there are on average 4 flaws in every 10 metres of cloth.
\begin{enumerate}[(a)]
\item Find the mean number of flaws in a 30 metre length.
\item Find the probability of fewer than 3 flaws in a 6 metre length.
\item Find the variance of the number of flaws in a 15 metre length.
\end{enumerate}

\begin{solution}
Assuming a Poisson distribution -- flaws in the cloth occur singly, independently, uniformly and randomly.
\begin{enumerate}[(a)]
\item If the mean number of flaws in 10 metres is 4, then the mean number of flaws in 30 metre lengths is $3\times4 = 12$.
\item If there are 4 flaws on average in a 10 metre length there will be $\frac{6}{10}\times4=2.4$ flaws on average in a 6 metre length. If $X$ is the number of flaws in a 6 metre length then $X \sim \text{Po}(2.4)$.
\begin{align}
& P(X<3) \\
=& P(X=0) + P(X=1) + P(X=2) \\
=& \mathrm{e}^{-2.4} + 2.4 \times \mathrm{e}^{-2.4} + \frac{2.4^2\times\mathrm{e}^{-2.4}}{2!} \\
=& (1+2.4+2.4\times1.2)\mathrm{e}^{-2.4} \\
\approx& 0.570
\end{align}
\item If the mean number of flaws in 10 metre lengths is 4, then the mean number of flaws in 15 metre lengths will be
$$\mu = \frac{15}{10}\times4=6.$$
Since, in a Poison distribution, the variance equals the mean the variance is 6.
\end{enumerate}
\end{solution}
\end{example}

\end{document}


This compiles fine and I want this to be the teachers' version. What I want for students' version, look like this:

Overall view

1. basically, just hide the content that is in solution.
2. but keep all the equation counters/labels, for example, first equation in Section 1.2 is (1.6), etc...
3. If possible, I want to keep the current exstyle and solstyle and I can customise them later. These are from here.
• It's usually preferable to edit the existing question (as long as it doesn't invalidate existing answers). I think it would be best if you put this material on the original question. – Teepeemm May 30 '18 at 13:35
• You could use the exam class for that. – dexteritas May 30 '18 at 13:51