# Why does k-NN (k=1 and k=5) does not use the nearest points?

I was looking at this picture and I do not understand why that one point (the one I drew an arrow at) gets classified with K = 1 and K = 5 in a blue area. For K = 1 the nearest neighbor should be the green one, definitely not a blue one and for K = 5 I can see 3 green points, 1 red point and maybe there's 1 blue point near. But in the end, that blue point should be green as well as far as I understood that algorithm. Can someone explain me why that point is not in the green area for K = 1 and K = 5?

It looks like the graphs are plotting the training data, and classification regions. The blue point is blue because it is labeled blue in the training data. The classification regions are created by visiting each pixel, and coloring it the color of the majority vote of the $$k$$ nearest training points to that pixel.
These points are the training set. So, for $$K=1$$, the closest point to the lower left blue point is itself. That's why you see a weird red region nearby. Similar situation for $$K=5$$, the closest points are two blues, two green and one red. It seems in case of equality blue has been chosen for that specific node.
When $$k = 1$$, you are computing a Voronoi diagram. So the partitions between classes will be made of line segments perpendicular to the two nearest points of differing colors. The point you indicate and the green point at about $$(4.9, 2.4)$$ establish the blue/green boundary to the right of your indicated point.
When $$k = 5$$, consider the cluster of one blue, one red, and three green points in $$[4.5, 5.1] \times [2.3, 2.5]$$. This is a set of $$k = 5$$ points, three of which are green. At the called out point, the distance to the blue member at $$(4.4, 2.9)$$ and the green member at $$(5.1, 2.5)$$ are (about) the same, so we should expect a transition from green dominance to a green-blue tie moving to the left somewhere near the called out point. The coloring scheme used appears to favor blue in such a tie.