Q:

Can four lines be perpendicular

Since in 2D two lines can be perpendicular and in 3D three lines can be perpendicular, what about 4D?
Is it possible to have four perpendicular lines in an n-dimensional space?

A:

Generally in $\mathbb R^n$ you can have $n$ (and not more) lines determined by the vectors
$$(1,0,0,\ldots0),\ (0,1,0,\ldots,0),\ \ldots\ ,(0,\ldots,0,1)$$
where each $2$ are perpenticular as their dot product is always $0$.
The dot product condition follows from the generalized version of the Pythagorean theorem in vector spaces which says that vectors $u,v$ are perpendicular if $\|u\|^2+\|v\|^2=\|u-v\|^2\Longleftrightarrow u\cdot v=0$ because $\|u-v\|^2=\|u\|^2+\|v\|^2-2u\cdot v$.

