A line that is perpendicular to the x-axis has an undefined slope. All of the points on such a line have the same x-coordinate. If the value of x never changes, then the formula for slope, (y2 - y1)/(x2 - x1), has a denominator of zero, which is mathematically undefined.
Dividing by zero does not yield a numerical answer. Because the inverse operation of division is multiplication, any division problem can be undone by a corresponding multiplication problem. For example, since six divided by two equals three, then three times two must equal six. However, if six divided by zero had a numerical answer, then the product of that number and zero would have to equal six, and multiplying any number by zero always yields zero.