Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

enter image description here

I am trying to understand this formula from the chart above.

For example, from the middle graph, How does h(x) = 0.5x get the coordinates 2,1?

Any explanations on the other graphs would be helpful, too.

Edit: How would I find theta 0 and theta 1 given the following graph?

enter image description here

share|cite|improve this question
'cause $h_\theta(2) = \theta_0 + \theta_1 2 = 0 + 0.5\cdot 2 = 1$ – fgp Mar 8 '14 at 15:33
@Emin -3? All jokes aside, I am horrible at math and would appreciate a concise answer – user1477388 Mar 8 '14 at 15:36
Well you've got it from @fgp – Emin Mar 8 '14 at 15:36
@Emin If you don't have anything constructive to add, please resist the urge to post a comment... – fgp Mar 8 '14 at 15:39
I see! My confusion was the existence of X being 2. It seems they are just randomly asserting that X is two (hence it being a variable, and all!). Once x = 2, the equation solves itself. Thanks for clarifying what should have been obvious to me. – user1477388 Mar 8 '14 at 15:51
up vote 1 down vote accepted

It shows three plots for three equations of a line. When the constant term $\theta_0$ is zero, the line passes through the origin (as the middle graph shows). When the "slope" $\theta_1$ is zero, the line is horizontal (constantly equal to $\theta_0$, the $y$ coordinate), as the first graph shows.

When the "slope" $\theta_1$ is positive, the function increases (with increasing $x$), and this possibility is illustrated by the second and third graphs. In fact if those graphs were better drawn, we'd see the lines are parallel (because the slopes of the two lines are equal).

The visual interpretation of $\theta_0$ is the height at which the line crosses the $y$-axis, and thus $\theta_0$ is called the $y$-intercept of the line. To see why this is so, notice that the $y$-axis is where $x=0$. Plugging $x=0$ into the equation, we get $y=h_\theta(0)=\theta_0$. So $\theta_0$ is the height ($y$-coordinate) where the line meets the $y$-axis. Increasing $\theta_0$ causes the whole line to shift up; decreasing $\theta_0$ causes the line to shift downward by that same amount.

The visual interpretation of $\theta_1$ is the direction and steepness of how the line tilts. Thus $\theta_1$ is called the slope of the line. A horizontal "level" line has slope $\theta_1 = 0$. A line that "rises" as points go from left to right has positive slope $\theta_1 \gt 0$. A line that "falls" as points go from left to right has negative slope $\theta_1 \lt 0$. Given two distinct points $(x_1,y_1)$ and $(x_2,y_2)$, the slope can be computed as the ratio of two differences:

$$ \theta_1 = \frac{y_2 - y_1}{x_2 - x_1} $$

In teaching we often refer to the $y$-coordinate difference as "rise" and the $x$-coordinate difference as "run", suggestive of the vertical and horizontal dimensions, and thus the mnemonic "slope is rise over run". The expression for slope $\theta_1$ above is usually simply called "the difference quotient".

The greater the absolute value of the slope, the steeper the line rises or falls. In the limit of increasing steepness, a line becomes vertical. However the equation of a vertical line is not like the examples shown above, $h_\theta(x) = \theta_0 + \theta_1 x$. Instead the vertical line will have an equation $x = C$, for some constant $C$ (i.e. saying all the points on the vertical line share a common $x$-coordinate).

share|cite|improve this answer
Thanks for your explanation. I updated my question with one more regarding this: How would I find theta 0 and 1 given a graph as shown? – user1477388 Mar 8 '14 at 16:09
We often call $\theta_0$ the "$y$-intercept" because it gives us the [ordinate]() where the line crosses the $y$-axis. As best I can make out from the graph, $\theta_0$ is very close to $0.5$, and given other information in the problem, I expect that's what you were supposed to answer. The "slope" $\theta_1$ is found by taking two points on the (flat) line and dividing the difference in $y$-coordinates by the corresponding difference in $x$-coordinates, the "rise" over the "run". In this case the slope seems to be close to $1$, i.e. the "rise" is about the same as the "run". – hardmath Mar 8 '14 at 16:17
So are you saying that in this example theta 0 is the rise and theta 1 is the run? Is there a visual way to understand your statement: The "slope" θ1 is found by taking two points on the (flat) line and dividing the difference in y-coordinates by the corresponding difference in x-coordinates, the "rise" over the "run". (?) – user1477388 Mar 9 '14 at 13:30
No, I'm saying to find the slope $\theta_1$, pick two points on the line. The difference in the two $y$-coordinates is the "rise", and the difference in their $x$-coordinates is the "run". (This is how the difference quotient, ratio of rise to run, is often taught at the high school/gymnasium level.) I'll add some to my Answer about "seeing" this in the graph, though it's in my Comment above already. – hardmath Mar 9 '14 at 17:22

The horizontal axis is for values of $x$ and the vertical one is for the values of a function $h_{\theta}(x)$. So if we have $h_{\theta}(x)=\theta_0+\theta_1x$ where $\theta_0=0$ and $\theta_1=0,5$ than you have the function $h_{\theta}(x)=0+0,5x=0,5x$ and for $x=2$ you have h_{\theta}(2)=0,5*2=1$ so if in the horizontal axis we take value 2 in the vertical one we get value 1. Thats how we get the coordinate (2,1).

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.