Question: I have two points `A (x1,y1)` and `B (x2,y2)` that are given as an input to the program. I have to find a third point `C` that lies on the line `AB` and is at a distance `10` away from the point A.

I can easily get the slope of the line but that doesn't give me the full equation for the line. Even if I get the full equation, I am not sure using this equation, how would I find out a point that is `x` distance away from A.

Any suggestions on how to approach this?

Answer: 
There are always two points on each line:

* get the vector from `A` to `B` (subtract the coordinates)
* normalize the vector (divide by its length; pythagorean theorem)
* multiply the vector by 10 **or** -10
* add the vector to `A` to get `C`

Note that if `A==B`, the line is not defined, and this algorithm causes a division by zero. You may want to add a test for equality at the beginning.
You can do it using vectors like this:

Let D = the difference between B and A (D = B - A)

Then any point on the line can be described by this formula:

```
point = A + Dt 

```

where t is a real number.

So just plug in any value for t to get another point. For example if you let t == 1 then the equation above reduces to point = B. If you let t = 0 then it reduces to point = A. So you can see that you can use this to find a point between A and B simply by let t range from 0 to 1. Additionally if you let t > 1, you will find a point past B.