How was the vector magnitude derived? The magnitude of a $n$-vector is defined as:
$$
\sqrt{a_1^2+a_2^2+...+a_n^2}
$$
or for those that prefer sigma notation:
$$
\sqrt{\sum_{i=1}^n a_i^2}
$$
How would this have been derived? Or was this one of those cases where mathematicians went trial-by-error to find a formula that seemed to work and then proved it later?
Note that for a vector $[a_1]\in\mathbb{R}$, the magnitude is obviously $\sqrt{a_1^2}=|a_1|$. For a vector $\begin{bmatrix}a_1\\a_2\end{bmatrix}\in\mathbb{R}^2$, using pythagros, the magnitude is $\sqrt{a_1^2+a_2^2}$. Then for a vector $\begin{bmatrix}a_1\\a_2\\a_3\end{bmatrix}\in\mathbb{R}^3$, consider the image:

In this case, $x=a_1$, $y=a_2$ and $z=a_3$. The length by pythagoras of $AC$ is $\sqrt{a_1^2+a_2^2}$. Using pythagroas again to find AB, the magnitude of out vector, we get:
$$AB=\sqrt{AC^2+a_3^2}=\sqrt{\sqrt{a_1^2+a_2^2}^2+a_3^2}=\sqrt{a_1^2+a_2^2+a_3^2}$$
Similarly for $\begin{bmatrix}a_1\\a_2\\a_3\\a_4\end{bmatrix}\in\mathbb{R}^4$, we get:
$$\sqrt{\sqrt{\sqrt{a_1^2+a_2^2}^2+a_3^2}^2+a_4^2}=\sqrt{\sqrt{a_1^2+a_2^2+a_3^2}^2+a_4^2}=\sqrt{a_1^2+a_2^2+a_3^2+a_4^2}$$
While this doesn't provide a rigorous proof for an n-dimensional formula in the euclidean metric, it provides some intuition into how you generalise the Pythagorean formula to dimensions higher than 2. You can prove the general case with induction, which I will leave to you if you want. I hope this helps!
Just try labelling the lengths of each of the vectors here and you'll answer the question for yourself: