Refer to the diagram shown below.
Define two positions on each line as A (x₁, y₁) and B(x₂, y₂).
Then the slope is
[tex]m= \frac{y_{2}-y_{1}}{x_{2}-x_{1}} [/tex]
Horizontal line:
Define A (0, 1) and B (1,1).
The slope is
[tex]m= \frac{1-1}{1-0}=0 [/tex]
Vertical line:
Define A( (1,0) and B(1,1).
The slope is
[tex]m= \frac{1-0}{1-1}= \frac{1}{0} [/tex] (undefined)