The Random Walk in Feynman's Lectures of Physics The distances in the random walk are unit positive or negative.
In the calculation for the distance, $D_N$ traveled after $N$ steps, the author uses $D_N^2$ instead of $D_N$. From The Feynman Lectures on Physics, Part 1,

The expected value of $D^2_N$ for $N>1$ can be obtained from $D_{N−1}$. If, after $(N−1)$ steps, we have $D_{N−1}$, then after $N$ steps we have $D_N=D_{N−1}+1$ or $D_N=D_{N−1}−1$. For the squares,
$$D^2_N = \begin{cases} D^2_{N-1} + 2 D_{N-1} + 1\\ \quad\quad or\\ D^2_{N-1} - 2 D_{N-1} + 1\end{cases}$$
In a number of independent sequences, we expect to obtain each value one-half of the time, so our average expectation is just the average of the two possible values. The expected value of $D^2_N$ is then $D^2_{N−1}+1$. In general, we should expect for $D^2_{N−1}$ its “expected value” $\left\langle D^2_{N−1} \right\rangle$ (by definition!). So
$$\left\langle D^2_N \right\rangle = \left\langle D^2_{N−1} \right\rangle + 1$$
We have already shown that $\left\langle D^2_1 \right\rangle=1$; it follows then that
$$\left\langle D^2_N \right\rangle = N$$

If I take $$  D_N =
\begin{cases}
D_{N-1} - 1,  & \\
or & \\
D_{N-1} + 1. &
\end{cases}$$
and then average out both of them to obtain $\langle D_N\rangle = \langle D_{N-1}\rangle$.
So this results in $\langle D_N\rangle = +1$ or $-1$ (because $D_1 = +1$ or $-1$) as opposed to the given $\sqrt N$.
Where in my idea did I go wrong?
 A: There are some problems with your analysis. First of all, the quantity $\langle D_n \rangle$ is the mean displacement (from the origin) as a function of the steps $n$.  Since the random walker is just as likely to turn left as right, it should be intuitive to you that $\langle D_n \rangle = 0$, rather than $1$, as you claim. I'm guessing that you have misunderstood what the "average" means in this case. The averages that are being taken here are over many different "realisations". In other words, you repeat the random-walker experiment many times, and at each time you measure the value of a particular quantity (say, $Q$). You then average over these quantities to get $\langle Q \rangle$.
As you have rightly pointed out, at the start, $D_1 = +1$ or $-1$ with equal probability. As a result, if you repeated the experiment many times, half the times the first step of the walker would be to the left ("$-1$"), and the other half it would be to the right ("$+1$"). This means that $$\langle D_1 \rangle = 0,$$ since that is the "expected" value. From this, you should be able to see that $\langle D_n \rangle = 0$.
The quantity that the author is computing, however, is more interesting: it is the mean distance covered by the random walker in $n$ steps. Since this quantity is independent of the direction in which each step is taken, one way to measure it would be to take the square of the variable $D_n$ and then compute the mean, i.e. $\langle D_n^2\rangle$. You could then take the square root of the resulting quantity to get an answer with dimensions of length. This is called the root-mean-square distance.
In general, for any randomly distributed variable $X$, $$\langle X \rangle^2 \neq \langle X^2 \rangle.$$ (You can easily check this by choosing a bunch of negative random numbers and computing their mean, and the mean of the squares. One will be negative, and the other positive!)
As a result, $\langle D_n \rangle ^2 \neq \langle D_n^2 \rangle$, so there is no contradiction.
