The slope is undefined for figure 2.
In general, when the x-values or x-coordinates is the same for both points, the slope is undefined.
For example, let us try to get the slope for a line passing through the points (1, 3) and (1, 9)
Let x₁ = 1 , y₁ = 9 and x₂ = 1 and y₂ = 3
Slope, m = (y₂ − y₁)/((x₂ − x₁)
m = (3 − 9)/(1 − 1)
m = -6/0, which is undefined.