how do I write the slope of a line containing points (-2,0) (-2,8)

slope = (y2-y1)/(x2-x1)=(8-0)/(-2+2) =8/0= infinity

The slope is indeed infinity, or more correctly, undefined. The line is parallel to the y-axis.

However, the equation of a line containing ANY two defined non-coincident points in the real domain can be found using the following formula that does not require division:

(y-y1)(x2-x1)=(x-x1)(y2-y1)

Applying the formula to P1(-2,0) P2(-2,8), we get
(y-0)(-2-(-2))=(x-(-2))(8-0)
0y=8(x+2)
Eliminating 0y and factoring out the 8, we get
x+2=0
as the equation of the line which has a slope of "infinity" or undefined.

The only trouble with the equation is it is not very easy to memorize.

To find the slope of a line containing two points, you can use the formula:

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

Given the points (-2, 0) and (-2, 8), let's label them as (x1, y1) = (-2, 0) and (x2, y2) = (-2, 8).

Substituting the values into the formula, we have:

slope = (8 - 0) / (-2 - (-2))
slope = 8 / 0

However, dividing by zero is undefined, so the slope of this line is undefined.

In this case, the line is vertical, as both points have the same x-coordinate. A vertical line does not have a defined slope using the traditional formula. Instead, we say the slope is undefined.