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

This might be very simple but I always take ages to plot a simple line on paper.

For example, if I have $Z=3x_1 + 2x_2$

What is the fastest way I can plot this correctly ? I always do a small table with $x_1$ and $x_2$ values and find where $x_2$ is located when $x_1=0$ or $ x_1=1$ etc ... this is very inefficient and time consuming.

Can someone tell me what methods are more superior than the one I use ?

share|cite|improve this question
Is $Z$ a constant? – Nameless Dec 28 '12 at 13:50
You only need two points to draw a line, if you have a straight edge. – Thomas Andrews Dec 28 '12 at 13:56
up vote 3 down vote accepted

Any line is completely determined by two points.

I.e., One and only one line can intersect two points (in Euclidean, Cartesian plane).

So it suffices to find two points on a given line.

Note: you can discover two points easily by setting $\quad x_1 = 0\implies x_2 =\dfrac Z2\quad$ and setting $\quad x_2 = 0 \implies x_1 = \dfrac Z3,\quad$ thus giving you the two points you need to graph the line!

Using your example, we can learn more about the line, and find an expression which plots one variable as a function of the other: $$Z=3x_1 + 2x_2,$$ with $Z$ is some constant (a particular value, depending on context). (You mention "plotting a line", so I am assuming we have a strict line.)

$$\text{Let}\quad y = x_1, x = x_2\quad$$ (so we can plot the function of one variable in terms of the other. You can use a same procedure, as what follows, if you want to plot $y = x_2$ in terms of $x = x_1$.)

$$Z = 3y + 2x \iff -3y = 2x - Z \iff y = -\dfrac 23x + \dfrac Z3\quad \left(x_1 = -\dfrac 23 x_2 + \frac Z3\right)$$

Then you have the equation for the line in slope-intercept form:

The line intersects the y-axis at $x = 0 \implies y = \dfrac{Z}{3}$, so one point is $\left(0, \frac{Z}{3}\right).$ (This is called the y-intercept). Then use "slope" $m$, which is the coefficient of the $x$ term, here $m = -\dfrac23 = \dfrac{\text{rise}}{\text{run}}$.

Slope will given you information about how one variable relates to the other. Positive slope givens you a line where one variable correlates positively with the other; negative slope gives you a line where one variable correlates negatively with the other variable.

From the y-intercept, move down two units (i.e., $-2$) along the y-axis, and three units in the positive x-direction, to the point $\left(3, \frac Z3 - 2\right)$.

With two points on the line (two points satisfying the equation), you can use a straightedge to draw the line connecting/intersecting the points and thereby plot the given line.

share|cite|improve this answer
THis was the simplest to understand, thank you. – NLed Dec 29 '12 at 14:15
You're very welcome, NLed. – amWhy Dec 29 '12 at 14:23

The most efficient way to graph a linear function in standard form, $ax_1 + bx_2 = c$ is to find the intercepts, if $a, b, c \neq 0$ (we'll discuss the cases when either $a=0$, $b=0$, or $c=0$ later). To find the $x_1$-intercept, simply substitute $x_2=0$. This gives:

$$ \begin{array}{rcl} ax_1 + b(0) &=& c\\ ax_1 &=& c \\ x_1 &=& \frac{c}{a} \end{array} $$

Thus, the $x_1$-intercept is $(c/a, 0)$. In a similar way, the $x_2$-intercept is $(0, c/b)$. Now that you have two points, you connect them with a staight line (since the function is linear). This method is quick, because you really don't have to write out the steps to solve for the intercepts once you understand that it's always "constant divided by coefficient" for both of the terms that appear.

What if $a=0$? Then we have $bx_2 = c$, and the graph is a horizontal line $x_2 = \frac{c}{b}$. But notice, the value on the right side is still of the form "constant over coefficient."

What if $b=0$? Then is't $ax_1 = c$, and the graph is a vertical line $x_1 = \frac{c}{a}$.

What if $c=0$? Then we have $ax_1 + bx_2 = 0$, and we can be sure that $(0,0)$ is on the line (do you see why?). We will just need a second point, so choose your favorite nonzero value for one of the variables and solve for the other. This produces a second point $(x_1, x_2)$ to plot. Connect with a straight line, and you got it.

Hope this helps!

share|cite|improve this answer
Thank you very much – NLed Dec 29 '12 at 14:14

In your example things are very simple. Write $x_2=\frac{Z-3x_1}2$ or if you prefer $$y=\frac{Z-3x}2$$ That is a straight line and can be drawn easily. Take two different $x_1,x_2$, compute $y_1,y_2$ and connect the points $A(x_1,y_1)$, $B(x_2,y_2)$ with a straight line.

Here are some more general tips:

If your contour can be written as $y=f(x)$ where $f$ is a function, then you just have to plot $f$.

  1. If $f$ is linear ($f(x)=ax+b$) then its graph is a straight line (as in your case) and can drawn easily (choose two points). You should also remember the graphs of $f(x)=ax^2+bx+c$, $f(x)=ax^3$, $f(x)=\sqrt{x}$, $f(x)=\frac{a}x$, $f(x)=\sin x$, $f(x)=\cos x$, $f(x)=\tan x$, $f(x)=e^x$ and $f(x)=\ln x$.

  2. If $f$ is a combination of the above and differentiable then you can find the intervals in which $f$ is decreasing or increasing, (where $f$ is convex or concave), the maxima and minima of $f$ as well as its asymptotic behavior $\lim_{x\to +\infty}f(x)$ and $\lim_{x\to -\infty}f(x)$ (supposing the two limits make sense). That's pretty much all the information you will need to plot it.

Otherwise you may have to break your $f$ in intervals in which it is differentiable and continuous etc. If your contour can't be written as $y=f(x)$ then the best you can do is to write it as $$y=\begin{cases}f_1(x)\\ f_2(x)\\ f_3(x)\end{cases}$$ and graph each $f$

An example: The unit circle: $$x^2+y^2=1$$ We have: $y=\sqrt{1-x^2}$ or $y=-\sqrt{1-x^2}$. I will plot $f(x)=\sqrt{1-x^2}$ for you: Observe $f$ is defined and continuous in $[-1,1]$, $f(x)\ge 0$ and $$f^{\prime}(x)=\frac{-2x}{1-x^2}$$ for $x\neq \pm 1$. Thus in $(-1,1)$, $f^{\prime}$ is positive in $(-1,0)$ and negative in $(0,1)$. Therefore $f$ is increasing in $(-1,0)$ and decreasing in $(0,1)$. In addition, $$f^{\prime}(x)=0\iff x=0$$ so at $x=0$ we have a local extremum $f(0)=1$ (that is a global maximum by the way). We also have $$f^{\prime}(x)=-\frac{2-2x^2+4x^2}{(1-x^2)^2}=-\frac{2x^2+2}{(1-x^2)^2}\le 0$$ and so $f$ is concave. Finally, $f(1)=f(-1)=0$ and $f$ has vertical tangets at these points (because $$\lim_{h\to 0}\frac{f(\pm 1+h)-f(\pm 1)}{h}=\pm \infty$$). With this information one can easily plot $f$

share|cite|improve this answer
Thank you for the thorough explanation – NLed Dec 29 '12 at 14:14

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.