Undefined slope means it is a vertical line.
If it is a vertical line the only number that matters from the point given is the x-value because the line would pass every y number on that x-value.
Equation of a line : y=mx+b
m=slope and b= y-intercept
There is not y-intercept because it is vertical and only passes through x, therefore the equation is x=5