Switch 2 elements in a 2d vector algebraically

58 Views Asked by At

I'm new to lineair algebra so maybe I am asking a silly question here.

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

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

which results in [1 5]

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

Is there a different way to switch the elements in a 2D vector algebraically, that could be explained by a geometric operation as well?

I was thinking of rotating v1 on a different axis in 3D, but that yielded a vector with twice the number of elements (4 in total).

The reason I am asking is because I would like to understand the dot product geometrically (for 2d vectors). And I am looking in to the relation with a parallelogram constructed by the 2 vectors, or the elements of the 2 vectors, summed separately.