# Machine Learning Overview | Visualizing the cost function

I have a question about what Andrew NG said.
It says that all three points have the same J , but in the upper left graph you can see that they have different J, since the blue line lies closer to the points and will have less J than the others. HELP ME TO UNDERSTAND!

Hi, @artem_titov1 !

It seems that what the points in the first graph refer to is the relationship between size and price in the data, while you can see the cost function more clearly in the second graph.

The straight lines in the first graph should have the same J (based on the second graph), but they are not.

You are only considering a rather zoomed-in version of the first graph. Since all 3 lines have different slopes, at a different value size the predictions might be farther in the blue line instead. Hence, they may have similar cost values as revealed in the 2nd graph.

The y axis of these graphs not represent the J(How much the cost) But these graphs show the relation between Two features for example graph upper right represent the relation between W on X axis and y axis is B and show when you reach to where b and W is should to be to become J global minimum …also professor Andrew NG didn’t wrongh as in for example upper right graph
show that the 3 points has same J as every Elliptical circle line represent same J …if you substitute with the(W & b) of the 3 points(Where the are different) you will computer same J …for more intuition in this photo

every line I marked it with the specific color the J(Cost) is same in it

Thanks!
Abdelrahman