Recently I wrote a problem like this:
Chloe starts at the origin. For each step, she moves $1$ unit in a random direction. Let $f(n)$ be the expected value of the her distance from origin after $n$ steps. Derive an explicit formula for $f(n)$.
Initially, I crafted a solution myself looking like this:
Since Chloe starts at the origin, $f(0)=0$. For the first step she moves $1$ unit in a random direction. However, regardless of the direction, she always travels a straight line which means that $$f(1)=1.$$ Let $\overrightarrow{F}(n)$ be the vector pointing from the origin to the position of Chloe after $n$ steps for an arbitrary path, and let $\overrightarrow{G}(n)$ be the vector that points from the position after $n$ steps to the position after $n+1$ steps. Then, $\overrightarrow{F}(n+1)=\overrightarrow{F}(n)+\overrightarrow{G}(n)$. Since we want to find the magnitude of $\overrightarrow{F}(n)$, we can use $\left[\overrightarrow{F}(n)\right]^2=\left|\overrightarrow{F}(n)\right|^2$ since $\cos(0)=1$. Thus, letting the angle between $\overrightarrow{F}(n)$ and $\overrightarrow{G}(n)$ be $\theta$, we have \begin{align*} \left|\overrightarrow{F}(n+1)\right|^2&=\left[\overrightarrow{F}(n)+\overrightarrow{G}(n)\right]^2\\ &=\left|\overrightarrow{F}(n)\right|^2+2\left|\overrightarrow{F}(n)\right|\left|\overrightarrow{G}(n)\right|\cos\theta+\left|\overrightarrow{G}(n)\right|^2. \end{align*} Since $\cos\theta$ can range from $-1$ to $1$ with equal probability, the expect value of it cancels out. (Formally, we need to calculate the expected value by summing up all of the possibilities. That is, $\int_{0}^{2\pi} \cos x~dx=[-\sin x]^{2\pi}_0=0$. But since this is not supposed to include calculus, an argument like above would be accepted.) Since we are using expected value, we have to plug in the expected value for $\left|\overrightarrow{F}(n)\right|$ which is $f(n)$. In addition, regardless of the direction, $\left|\overrightarrow{G}(n)\right|=1$. Therefore, \begin{align*} \left[f(n+1)\right]^2&=\left[f(n)\right]^2+1. \end{align*} We can proceed by induction. The base case is $f(1)=1$ which follows $f(n)=\sqrt{n}$. (Using $f(0)=0$ as the base case is also acceptable) Assume $f(k)=\sqrt{k}$ for a positive integer $k$ and we have to prove that $f(k+1)=\sqrt{k+1}$. From the above equation, we have $[f(k+1)]^2=\left(\sqrt{k}\right)^2+1$ which gives $f(k+1)=\pm\sqrt{k+1}$. However, since distance is always positive, $f(k+1)=\sqrt{k+1}$. Therefore, $\boxed{f(n)=\sqrt{n}}$ for all nonnegative integers $n$.
However, I was told that the solution is wrong. Specifically, the expected value of $[f(x)]^2$ is not necessarily the square of the expected value of $f(x)$. Indeed, when I run a program to confirm my results, they were so far off that it could not be that my sample size is not big enough.
Progress after finding the mistake:
$f(1)=1$ and $f(2)=\frac{1}{\frac{\pi}{2}}\int_{0}^{\frac{\pi}{2}}2\sin x~dx=\frac{4}{\pi}$, but I could not get any further.
I also ran my program (100000 repeated trials for each $n$ and take the average distance) for $n$ from $1$ to $99$ and plotted in a graph on desmos. It still seems like $f(n)=an^b$, but I cannot find the exact values of the constants $a$ and $b$.
I would appreciate it if there is a precalculus solution, but light calculus would be fine as well. Thank you in advance!