I know that you draw an absolute value graph by writing the equation in the format of $y = a \vert x - p \vert + q$ and I know how to draw it from there, but what do you do when there is an $x$ value outside the absolute signs?
6 Answers
We can write absolute value as a piecewise function,
$$|x| = \begin{cases} x & x\geq 0,\\ -x & x<0\end{cases}$$
Using that for your equation will give you two functions to graph, one on the positive half of the line and the other for the negative half.
- 7,645
Use WolframAlpha or the method that @TonyS.F. said:
Code: Plot[Abs[2*x+1]+x-3,{x,-10,10}]
- 28,671
Let's call the function $f$, so $f(x)=|2x+1|+x-3$. You can evaluate $f$'s value for some $x$s, plot the $(x,f(x))$ points, and connect them. Since it's linear, you should connect the points with lines.
- 11,938
By the definition of the absolute value, you have:
$$\left|2x+1\right| = \begin{cases} 2x+1 &\mbox{if }\; x\geq -\tfrac{1}{2} \\ -2x-1 &\mbox{if }\; x< -\tfrac{1}{2} \end{cases}$$
and thus:
$$\left|2x+1\right|+x-3 = \begin{cases} 3x-2 & \mbox{if }\; x\geq -\tfrac{1}{2} \\ -x-4 & \mbox{if }\; x< -\tfrac{1}{2} \end{cases}$$ So graphing comes down to drawing two (half)lines: one on each side of $x=-\tfrac{1}{2}$.
- 27,903
- 34
- 63