In the general case we can complete the square as follows:
#y = ax^2+bx+c = a(x+b/(2a))^2+(c - (b^2)/(4a))#
Notice especially the #b/(2a)# term, which gives us the #-4#. Normally you just observe the #a# and #b# terms and look at what you get when you multiply out #a(x-b/(2a))^2# rather than following the above formula. On this occasion, let's just use the formula...
In our case #a=1#, #b=-8# and #c=7#, so
#y = x^2-8x+7#
#= 1*(x+(-8)/(2*1))^2+(7-((-8)^2)/(4*1))#
#=(x-4)^2+(7-64/4)#
#=(x-4)^2+(7-16)#
#=(x-4)^2+(-9)#
Vertex form of a quadratic is:
#y = a(x-h)^2+k# where #(h,k)# is the vertex.
So in our case #(h, k) = (4, -9)#
Why is this the vertex?
Well #(x-h)^2 >= 0# will only be zero when #x-h = 0# - that is when #x = h#. When #x=h# then #y = 0+k = k#, hence #(h, k)#.