Dividing a segment in a ratio, and the distance from a point to a line

Find the point that divides a segment in a given ratio, and the distance from a point to a line with the formula.

Guide

If P divides AB in the ratio m : n (AP : PB = m : n), P is m(m + n) of the way from A to B. Its coordinates are a weighted average of the two ends: x = n·x1 + m·x2m + n. Watch the order of the ratio: 1 : 2 means closer to A.

The shortest way from a point to a line is the perpendicular dropped from the point onto the line, not the vertical drop. The length of that perpendicular is the distance from the point to the line.

For the line ax + by + c = 0 and the point (x1,y1), the distance is d = |a·x1 + b·y1 + c|/√(a2 + b2).