How to maximise this function: $p \log (1 + x) + q \log (1 − x)$? I was trying a past paper from http://www.abacus.utwente.nl/tentamens/M%20-%20Stochastic%20Processes/1a%20-%20Stochastic%20Processes%20Februari%202007.pdf
Hint: Use the fact that $p \log (1 + x) + q \log (1 − x)$ is maximized when $x = p − q$.
Secondly it was written: Let $f : (-1,1) \rightarrow \mathbb{R} : x \mapsto p\log (1+x) + q \log (1-x).$ Then using the hint above, $f$ is maximised at $p-q$ and $f(p-q) = \log 2 + p\log p + q\log q.$

My first question is, how (possibly using analysis/calculus?) would you deduce/get that $p \log (1 + x) + q \log (1 − x)$ is maximized when $x = p − q?$
The other thing, I have trouble understanding what exactly does $f : (-1,1)$ mean? And how would I intepret/read the following line? Its a bit new to me as I have not seen functions written like the following before. $f : (-1,1) \rightarrow \mathbb{R} : x \mapsto p\log (1+x) + q \log (1-x).$  
Lastly, it says that $f$ is maximised at $p-q$ and $f(p-q) = \log 2 + p\log p + q\log q.$ How do you get that $f(p-q) = \log 2 + p\log p + q\log q?$ I tried substituting it into $f(x)=p\log (1+x) + q \log (1-x)$, getting  $f(p-q) = p\log(1+p-q) + q\log(1-p+q). $ How would I go about from there?
 A: For your first question, you can see that $p \log (1 + x) + q \log (1 − x)$ is maximized when $x=p-q$ by taking the derivative at setting it equal to $0$. We have
$$0=\frac{d}{dx}(p \log (1 + x) + q \log (1 − x))=-\frac{p}{1+x}+\frac{q}{1-x}=\frac{-p(1-x)+q(1+x)}{(x+1)(x-1)}$$
and so $(q-p)+(p+q)x=0$ hence $x=\frac{p-q}{p+q}$, and since $q=1-p$ this simplifies to $x=p-q$. This tells us that $p \log (1 + x) + q \log (1 − x)$ has an extremum at $x=p-q$, and this extremum must be the maximum as making $x$ near $1$ or $-1$ makes $\log(1-x)$ or $\log(1+x)$ very negative, respectively.
For your second question, "$f: (-1,1)$" doesn't mean anything. However, the full statement "$f:(-1,1)\to \mathbb R$" means "$f$ is a function from $(-1,1)$ to $\mathbb R$ (the real numbers)". In your case, the statement
$$f : (-1,1) \rightarrow \mathbb{R} : x \mapsto p\log (1+x) + q \log (1-x)$$
means "$f$ is a function from $(-1,1)$ to $\mathbb R$ such that $f(x)=p\log (1+x) + q \log (1-x)$ for any $x\in (-1,1)$ (any $x$ between $-1$ and $1$)".
Edit: To get that $f(p-q)=\log 2+p\log p+q\log q$, use the fact that $p=1-q$ and $q=1-p$ so 
$$\begin{eqnarray}
f(p-q)&=&p\log(1+p-q) + q\log(1-p+q)\\
&=&p\log(1+p-(1-p)) + q\log(1-(1-q)+q)\\
&=&p\log(2p) + q\log(2q)\\
&=&p(\log 2+\log p) + q(\log 2+\log q)\\
&=&(p+q)\log 2+p\log p + q\log q\\
&=&\log 2+p\log p+q\log q.
\end{eqnarray}$$
A: $f: (-1,1) \to \mathbb R$ just means that $f$ is a function defined on the interval $(-1,1)$ with values in the real line.  
To find critical points of $f(x) = p \log(1+x) + q \log(1-x)$, solve $f'(x)=0$ for $x$.  You should find exactly one critical point, at $x=p-q$ (if you remember that $p+q=1$).  Note that this is a local maximum  (e.g. by using the second derivative test, or noting that $\log(1+x)$ and $\log(1-x)$ are concave functions).  If a differentiable function has only one critical point in an interval and it is a local maximum, then it is a global maximum on that interval.
