# What's so different/complicated/useful about vectors?

Forgive me if this isn't considered a real question, but it is something I am genuinely confused about.

I constantly hear other game developers talk about how using vectors are very useful, but also how everyone is intimidated by vector math and vectors can seem daunting. I have never got around to learning about them.

So, finally I looked Vector on Wikipedia, and I was surprised. Unless I am somehow mistaken, a vector(for sake of simplicity, say it's 2D), is just an x and y coordinate. If I have misunderstood, please correct me.

So here is my question: doesn't that mean that any representation of two(or three) dimensional coordinates is a vector? If so, then a vectors and coordinates are the same thing. And it's pretty much impossible to create a game without using coordinates, so how are vectors confusing or new to someone who has done any amount of game programming?

This is something I could use some clarification on. Any help is appreciated.

• Vectors are pretty simple up until you start doing rotations in 3D... then you need quaternions and those will blow your mind. Sep 27, 2013 at 18:12
• The notion of vector is really confusing. I have asked in in math, math.stackexchange.com/questions/429363, math.stackexchange.com/questions/384927 but had got no clear response. It is pure frustration. May be you can add to it.
– Val
Sep 28, 2013 at 10:16
• With all the bad analogies in these answers it's no wonder people get confused. Sep 28, 2013 at 18:37

Don't let a math major hear you calling Vectors points or coordinates!

A 2D vector has an x and y component, not coordinate. Vectors do not define a position, they define a direction and a magnitude.

I can't tell you why people are intimidated by them, likely the same reason people are intimidated by math in general, because everyone says it's hard before they know anything about it!

Vectors and coordinates are not the same thing. They do look similar, but they way they're used is very different.

Coordinates define a position in the world. Vectors define a direction and magnitude. The two of them are often used together. As an example:

A character has a position and a velocity. The position is a coordinate and the velocity is a vector. Adding the velocity to the position will move the character in the direction of the vector at a distance defined by the magnitude of the vector (note that the magnitude of the vector is the speed, so this gives us a direction and a speed).

Or in this example: The two characters have positions and the laser shot is a vector. A vector between the two positions is (3,1). That means it travels +3 along the X axis and +1 along the Y axis. Where the magnitude can be found with Sqrt((XX) + (YY)).

A good overview of vector math can be found on the Wolfire blog

• It's not only Mathematicians who get upset when someone calls a Vector a point or coordinate. Us physicists will mess you up, too. Sep 27, 2013 at 18:03
• +1 But if I'm nit picking, velocity is a vector and speed is the magnitude of that vector. Sep 28, 2013 at 3:44
• @Val: I wouldn't say it's nonsense. It addresses the question's misconception that vectors are just x- and y-coordinates. Making the answer more formal or accurate by mentioning 'elements of vector space' wouldn't do anyone any good except help explain why people find vector algebra intimidating. Sep 28, 2013 at 11:47
• The vectors are only a position in that they tell you where you would be if you applied them to (0,0). Vectors can modify a position, but don't contain position information in themselves. I understand what you're saying. I think the difference we're talking about is not significant to this question. This is the way vectors are used in game development. Thanks for your input.
– House
Sep 28, 2013 at 15:18
• @Val: any good linear algebra lecture will agree with Byte56: vectors are not the same as positions in space. It makes sense to add “3 miles north and 1 mile east” to “1 mile south”; but it doesn’t make sense to add “the position of the White House” to “the position of the Pentagon”. Once you fix point of reference as (0,0), you can use vectors to determine points, and vice versa, so in some representations, they look similar; but they’re different. Abstractly: compare affine space vs. vector space.
– PLL
Sep 29, 2013 at 0:35

I think the intimidation factor may arise when you start dealing with more complicated operations such as normalization, dot and cross products, and using multiple coordinate systems with matrices to transform between them. These are not necessarily easy to understand at first, even if you have a strong geometry and algebra background.

Also, at least in the US, people who have gone through the typical high-school math sequence are accustomed to thinking about geometry in terms of lines, slopes, angles, etc. They have to unlearn that stuff to some extent, and learn to think about it in terms of vectors and matrices instead. It's not that the concepts of linear algebra are such a stretch, but that they are a somewhat different set of concepts than the ones used in classical geometry, which people are likely to have learned in school.

BTW, the distinction between vectors and points lies in the operations you can perform on them. Although both are represented (in a particular coordinate system) by a list of components, and therefore look "the same", the operations allowed are not the same. For instance, you can add two vectors, or multiply a vector by a scalar. You can't do that with points - or at least, it doesn't make any sense to do so. But you can subtract two points, and the result is a vector from one point to the other. You can also add a point to a vector to get a new point.

Points and vectors also behave differently with respect to transformations. Namely, points are subject to translation, while vectors are not. Consider the example of an object moving with a position (point) and a velocity (vector); if you translate the object to a different place, you alter its position, but not its velocity.

In fact, furthering this line of reasoning, there are not just vectors; there are other entities like covectors and bivectors, which may also "look like" a vector in terms of having a list of components in a coordinate system, but which behave differently in terms of the operations available and the way they react to transformations. These all belong to a field of math called Grassmann algebra. Beyond that, one can be even more general and consider tensor algebra. This is advanced stuff though.

• A large part of my confusion was why people thought vectors were so complicated, so this helped. Perhaps I find them simple because I was actually using geometry in programming before I ever took high school geometry. Sep 27, 2013 at 18:01
• The example of position vs velocity used in a couple of answers breaks down when you have position (point), velocity (vector), and acceleration (vector). If you change the velocity, the acceleration does not change, yet they are both vectors. The distinction between vector and point, while correct, is a distraction - in practice all games store positions as vectors which are implicitly relative to the origin (perhaps indirectly if using a scene graph). Sep 27, 2013 at 19:01
• @AlistairBuxton I don't follow your point - if you translate your coordinate system, neither an object's velocity nor acceleration change, but if you rotate the coordinates, then both the velocity and acceleration would get rotated. So I don't see where anything "breaks down". Sep 27, 2013 at 20:38
• @AlistairBuxton And there's no such thing as "store positions as vectors". Games store both positions and vectors as lists of scalar components in a particular coordinate system. That doesn't make them the same thing. To make an analogy: ints and floats are both stored as a list of binary bits, yet mean different things and have different operations. Sep 27, 2013 at 20:40
• @Val You're completely off base. A vector is not [p-position, v-velocity]. It doesn't have both a point and a velocity inside it. It's just [x-velocity, y-velocity, z-velocity] (for a velocity vector). The point is that this is a different type of thing from [x-position, y-position, z-position]. Sep 29, 2013 at 0:31

Vectors really aren't that bad. There is just a bit of math that people are unfamiliar with.

First and foremost, a Vector does not represent a position in space. This is conceptually very important. A vector represents a direction, like 'North', and a magnitude. On a map with normal Math X-Y coordinates, 'North' would be the vector (0,1) (up on the Y Axis). This should not be confused with the position (0,1), which is one unit above wherever you put the origin. A vector is a direction and a magnitude.

Displacement (movement) is a vector (like move two units up and one unit Right), Position is not.

Vectors, in and of themselves, are not what people have a problem with. Usually it's matrices and operations on vectors.

For example, if you multiply a Vector by special matrix called a 'Rotation Matrix', then the vector is rotated by the amount specified by the matrix. Additionally, some people have issues with Matrix multiplication. Look it up if you're not familiar with it.

Further, you can 'stack' these matrices (or operations) together. Like Rotate 90 degrees around the X axis, then Rotate 90 degrees around the Y axis. If we call the first one Matrix M and the second one matrix N, then the operation would be v*M*N. However, Matrix multiplication isn't commutative, so that is not the same as v*N*M.

In Graphics programming, you do considerably more complicated operations on vectors and other matrices regularly. Transformations for FoV and to put your coordinates in screen space, etc. It's really not that bad, but it can be intimidating for new people.