In your first example you have (2,-1),(4,2)
That really means you have two points that you KNOW. The first point is (2,-1), and the second is (4,2).
When we write down a point as (2,-1), the first number is assumed to be the "along" or horizontal value (which we usually call x), and the second number is the up-down value (called y).
So we could restate the problem in simple english as:
What is the line that passes through the point 2 spaces along and 1 space down (-1 is down) and also through the point 4 spaces along and 2 spaces up.
OK, you probably knew all that, so on with the meaty stuff.
First you work out the slope, which is how fast the line rises.
Well, we know the two points (2,-1),(4,2), so we can see that the line moves along from 2 to 4 while moving from 1 space down to 2 up.
So it moves along (4-2)=2 spaces while moving up (2-(-1))=3 spaces. So the slope is 3/2.
(Just think, if you were walking uphill, and you went up 1 meter for every 10 meters forward, that is a light slope upwards, and is a 1/10 slope, but if you had to go up 3m for every 2m along that would be a steep slope of 3/2)
The formula we just used is: m (the slope) = (y2 - y1) / (x2 - x1)
In other words m = (2-(-1)) / (4-2) = 3/2.
Next you work out the "intercept", which is where the line crosses through x=0 (which is the y axis if you draw a proper graph)
Well, we know that the slope is 3/2, so we can just start at any point and figure where the line would be when x=0
So, let's start at the first point (2,-1) (2 steps along, one down)
And we know that the line moves 3 steps up for every 2 steps along. But we need to move 2 steps BACK to get to zero, so in the same time the line must move 3 steps DOWN.
So, the y-value (the up-down value) started at "one down" and moved a further 3 steps down, so it must be at 4 steps down when x is at 0.
The formula we just used is: b (the intercept) = y1 - (m * x1) in other words, start at y1 and travel backwards along the slope x1 steps, because we want x1 to be zero.
m (the slope) = 3/2
b (the intercept) = -4
This can be written even more neatly as y = (3/2)x - 4
Proof: at 2, y = 1.5*2-4 = 3-4 = -1, at 4, y = 1.5*4-4 = 6-4 = 2
Your other solutions can be done the same way, but because we now have the formulas to work them out, we can just trust to mathematics that they will work.
m (the slope) = (y2 - y1) / (x2 - x1) = (-1-1) / (-1-(-3)) = (-2)/(-1+3) = -2/2 = -1
b (the intercept) = y1 - (m * x1) = 1 - (-1)*-3 = 1 - 3 = -2
y = -1x-2
m (the slope) = (y2 - y1) / (x2 - x1) = (1-1) / (6-2) = 0/4 = 0
b (the intercept) = y1 - (m * x1) = 1 - 0*2 = 1
y = 0x + 1 = 1 (ie the equation of the line is just "y=1", no matter what value x is, y will always equal 1)
Hey, you can do the rest for practice !