# Math Cosmetics!

## Recommended Posts

These questions may seem a bit unusual, but let's give it a try: 1) Why is the default slope formula "m = (y2-y1)/(x2-x1)" and not "m = (y1-y2)/(x1-x2)" 2) Say you have to label two arbitrary points on a line, with the labels P1 and P2, would you put P1 to the left and P2 to the right, just because it looks nice? Or are there any official rules involved? Tnx

##### Share on other sites
And what do you do if the line happens to be vertical? ;)

##### Share on other sites
Quote:
 Original post by MuzzafarathAnd what do you do if the line happens to be vertical? ;)

Hehehehhe

##### Share on other sites
Ack, try to stay away from the homework questions.

But while I'm here, I guess the reasoning behind the (y2-y1)/(x2-x1) is that if the line has a positive slope, you will be left with a positive numerator and denominator. (EDIT: and if the line has a negative slope, either numerator or denominator will be negative. So P2-P1 lets you work with negatives less. Everyone hates negatives hahaha =)

Official rules about it would be stupid, as the two are perfectly equivalent

(y2-y1) / (x2-x1)
-(y2-y1) / -(x2-x1)
(y1-y2) / (x1-x2)

##### Share on other sites
Quote:
 Original post by NeosmyleBut while I'm here, I guess the reasoning behind the (y2-y1)/(x2-x1) is that if the line has a positive slope, you will be left with a positive numerator and denominator. (EDIT: and if the line has a negative slope, either numerator or denominator will be negative. So P2-P1 lets you work with negatives less. Everyone hates negatives hahaha =)

Thank you, that's pretty clear. From what you are saying here I can also deduce the points (x1,y2) and (x2,y2) are put on the line from left to right by default :)

[Edited by - Raab314159 on August 3, 2004 4:25:05 PM]

##### Share on other sites
No, they are not put on the line from left to right by default... nor is the ordering determined by the direction the line runs... well, at least, not directly.... the direction the line runs is a consequence of something else... and that is trigonometry.

The gradient of a line, m, (which you must remember is a gradient relative to something else) is equal to the tan of the angle between the line and the positive x axis. So, we know that the gradient is measured relative to the positive x axis. tan increases from zero with positive angle from 0 radians up to pi/2 radians, so therefore gradient must also increase in that direction. If the gradient of the line is defined by the change in the vertical direction divided by the change in the horizontal direction, then the this implies an ordering on the points on the line and in the equation for gradient.

As to what happens when the line is vertical, you have an infinite vertical change divided by a zero horizontal change, which gives an infinite gradient (which can be confirmed by checking that the tan(pi) = infinity.

Cheers,

Timkin

##### Share on other sites
1) The vector that goes from (x1,y1) to (x2,y2) is (x2-x1,y2-y1). You can then get the slope by dividing (y2-y1)/(x2-x1). I find that choice more elegant.

2) Ask a mathematician to draw an arbitrary line, and you will get a horizontal line. Ask him to put two points P1 and P2 on it, and you will get P1 on the left and P2 on the right. We mathematicians have limited imaginations. :)

##### Share on other sites
Ask me to do an arbitrary line and you get a 45 degree positive slope, but maybe that's because I'm a physicist?

Any other disciplines want to add to this little psychological experiment?

##### Share on other sites
I will go for the .25 * PI radians line.. but that's because I'm a programmer ;)

About the labeling.. If I draw a 45 degrees line I would label the left point (x1,y1) and the right point (x2,y2) just because I read from left to right and the numbers go from low to high..

But I would calculate m then with (y2 - y1) / (x2 - x1) to make sure I get a positive slope.

##### Share on other sites
If asked to draw an arbitrary line, I'd draw a circle... it's one of the hardest shapes for a human to draw, yet one of the simplest and most elegant! ;)

...and I doubt this choice has anything to do with my educational training (maths/physics/philosophy/computing).

Timkin

##### Share on other sites
Quote:
 Original post by TimkinAs to what happens when the line is vertical, you have an infinite vertical change divided by a zero horizontal change, which gives an infinite gradient (which can be confirmed by checking that the tan(pi) = infinity.

Or, more accurately, tan(theta approaches pi) approaches plus or minus infinity, since it goes to different places depending on which way you're coming from.

##### Share on other sites
1) There is no "default" slope formula. Thinking that there is a "default" formula just means that you don't understand your maths.
The reason why they teach you "m=(y2-y1)/(x2-x1)" is to avoid dividing a negative by a negative. It confuses people when they are first learning about gradients. The whole point is that you define gradient as "Rise over Run", so we leave it as a positive over a postive when using cartesian co-ordinates.

as for 2)
with labels there are no official rules involved, but if the labels are in a directly related numerical order, you should follow the co-oridinate system. In the case of cartesian, you should stick p1 on the left and p2 on the right.
On the other hand, if your plotting something that is in order like the names of cash registers, but you are plotting them on a line that only shows revenue earned, they aren't correlated so just wack p1 and p2 wherever it is appropriate.
It comes down to how it is relevent to the data.

I find a naming convetion such as "Fred" on the left and "Rubber Ducky" on the right is usually sufficient enough to confuse any reader into ignoring your labeling convention.

##### Share on other sites
Quote:
Original post by liquiddark
Quote:
 Original post by TimkinAs to what happens when the line is vertical, you have an infinite vertical change divided by a zero horizontal change, which gives an infinite gradient (which can be confirmed by checking that the tan(pi) = infinity.

Or, more accurately, tan(theta approaches pi) approaches plus or minus infinity, since it goes to different places depending on which way you're coming from.

Not really. There are several types of infinity. For real numbers, there are two options: you can add two points "-infinity" and "+infinity", or you can add a single point "infinity" which is reachable from both ends. The first construction is common in Analysis (a.k.a. Calculus) when talking about limits. The second construction is the one used in Projective Geometry, which is the appropriate framework to describe the slope of a line.

The slope of a line should be an element of the 1-D real projective space, instead of a real number. The difference is only that the 1-D real projective space has a valid representation for vertical lines.

Saying that "tan(pi) = infinity" makes perfect sense to me, because we can see tan as a function that takes a real number and returns an element of the 1-D real projective space.

In case it is not clear by now, I like Geometry better than I like analysis. :)

##### Share on other sites
am I on crack, or is it tan(pi/2) = infinity.

##### Share on other sites
Hahahaha. Nice catch, Krumble. I'll stop posting here and annoying Timkin again now.

##### Share on other sites
Krumble, you are perfectly correct... someone else picked up on my typo as well... I just hadn't had time to correct it... sorry...

Of course tan(pi/2) = infinity and not tan(pi), which infact equals zero.

Sorry for the really bad typo and the confusion it may have caused.

Cheers,

Timkin

##### Share on other sites
Woah damn. I saw that and thought it was wrong and then wondered if I was going nuts... O_O

##### Share on other sites
Well, assuming x2 > x1, then x2-x1 is always positive, the intuitive physical interpretation of "difference" between x1 and x2. That's very convenient.

##### Share on other sites
Quote:
 Original post by SquirmAsk me to do an arbitrary line and you get a 45 degree positive slope, but maybe that's because I'm a physicist?

OMFG I was thinking the exact same thing. And I'm also a physicist...

##### Share on other sites

To summarize:

We label points from left to right, just because we read from left to right.Then:

(y2-y1)/(x2-x1) Is better than (y1-y2)/(x1-x2) because in the first case the the denoninator is *always* positive
(only if we put P1 to the left and P2 to the right)

##### Share on other sites
i think it's because x2-x1 and y2-y1 is a vector from x1,y1 to x2,y2 ....
also dX/dY thing,too.
and of course not working with negative too.

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628278
• Total Posts
2981789

• 10
• 11
• 17
• 14
• 9