How can speed be the magnitude of velocity Say speed is the magnitude of velocity then:
\begin{align*}
v &=\left|\vec{v}\right|\\
\frac{D}{\Delta t} &= \left|\frac{\Delta \vec{x}}{\Delta t}\right|\\
\end{align*}
since $\Delta t$ is always positive, we get:
$$D = \left|\Delta \vec{x}\right|$$
which is not true.
$D$ = distance travelled
$\Delta \vec{x}$ = displacement
$||$ is magnitude
$\Delta t$ is time taken
$v$ is speed
$\vec{v}$ is velocity
 A: Let me be specific here. Speed is not the magnitude of velocity but instantaneous speed is the magnitude of instantaneous velocity. As pointed out by Brain Stroke Patient, this happens in the limiting case as $ lim \Delta t \rightarrow 0$. In that case, $|\Delta\vec{x}|\rightarrow D$.
I think your confusion is that distance travelled and displacement aren't the same (the former is path dependent and the latter isn't) and this can't happen. But in a time interval that is practically zero (infinitesimally small but non-zero actually), the amount of displacement can be thought of as the smallest step you could take in whatever direction. That amount of displacement in that time interval is also the distance travelled in that same interval.
A: $\vec{v} = \Delta \vec{x}/\Delta t$ for infinitesimally small displacement and time. In that limit D is equal to $\Delta x$. If the displacement isn't infinitesimal then you have the average velocity and that need not be equal to, in magnitude, to the average speed.
