# How to know if the given vector is less or greater than the other vector?

I'm creating a Bounding Box for my game engine right now and I need to get the vector min and max of the given model. I'm going to loop on all vertices then check if is the minimum or the maximum then use it to draw a box on the whole model.

I'm new in linear algebra and also new in 3D world. Is there any formula on how to know if the given vector is less or greater than the other vector?

If you are comparing their lengths/magnitudes, using norms should work. Norm is kind of a fancy term for length in most cases.

The easiest way to visualize a norm is to consider the two-dimensional case. If we have some vector (a, b) then we can find its length by considering the horizontal and vertical projections. The horizontal component is a horizontal line segment (along the x-axis) of length a (x runs from 0 to a). The vertical component, similarly, is of length b (y runs from 0 to b). We now just have a right triangle and can use the Pythagorean theorem to find the length of (a, b). The norm is usually indicated by notation similar to absolute value bars or some texts use two absolute value bars.

$$||(a, b)|| = \sqrt[]{a^2 + b^2}$$

Vectors with more than two components are pretty similar for the Euclidean norm.

If $$x = (x_1, x_2, ..., x_n)$$ then

$$||x|| = \sqrt[]{x_1^2 + x_2^2 + ... + x_n^2}$$

HallsofIvy