Linear Algebra – algebraically converts 2 elements in a 2D vector


I'm new to lineair algebra, so maybe I'm asking a stupid question here.

What I mean by title is this command in Matlab / Octave:

v1 = (5 1)
sqrt(rotateVector(v1, (deg2rad(90))).^2)

what results (1 5)

I understand this to work only for an initial vector with positive values ​​for its elements.

Is there another way to algebraically switch the elements in a 2D vector, which could also be explained by a geometric operation?

I thought about rotating v1 in 3D around another axis, but that resulted in a vector with twice the number of elements (4 in total).

The reason I'm asking is because I want to understand the dot product geometrically (for 2D vectors). And I look at the relationship to a parallelogram composed of the two vectors or the elements of the two vectors.