I want to shift a line right some points, regardless of its slope. For example, a vertical line will shift to the right by having its two y coordinates changed, [$(x_1, y_1+some number)$ $(x_2, y_2+some number)$], similarly a horizontal line will be shifted down by having its x coordinates changed only. Any lines that are not horizontal or vertical, will also be shifted by having both of their x and y coordinates changed. How can this be done?
-
$\begingroup$ Sounds like you've mixed between "vertical" and "horizontal". In addition, your explanation in parenthesis looks wrong. It should be $(x,y)\rightarrow(x,y+\text{some value})$. $\endgroup$– barak manosMay 28, 2016 at 5:59
4 Answers
Decompose your "diagonal" shift into an horizontal shift and a vertical shift. It does the job, doesn't it?
y=mx+b.
Upward shift: y=mx+b+a (a=upward shift, negative = downward).
Right Shift: y=m(x-c)+b (c=right shift, negative = left shift).
Any Shift: y=m(x-c)+b+a.
It looks like that you are talking about linear functions. The equation is
$y=mx+b$
If you want to shift the graph $y_0$ units upwards and $x_0$ units to the right then the equation becomes
$y+y_0=m(x-x_0)+b$
For downward shifting and shifting to the left you have to change the signs.
Numerical example
Suppose the initial function is $y=2x+2$. And now we want to shift it $1$ unit upward and $3$ units to the right. The equation becomes
$y+1=2(x-3)+2$
Multiplying out the brackets
$y+1=2x-6+2$
Subtracting 1 on both sides
$y=2x-6+2-1$
$y=2x-5$
For a more general approach to shifting ANY function (line, parabola, sinusoidal, what have you), we can simply consider shifting any function $f(x)$ horizontally or vertically.
$$f(x) = y$$
If we want to shift the function upwards by $u$, this is the same as adding $u$ to every $y$ value the function produces. We can consider a function $f_2(x)$ such that which is $f(x)$ shifted upwards by $u$.
If $f(x) = y$,
Then $f_2(x) = y + u$.
Subsequently, $f_2(x) = f(x) + u$
Now, let's consider horizontal shifts to the right by $v$. To achieve this, we have to consider what it means to move the function to the right. It means for every $x$, we're going to move its associated $y$ to $x + v$ instead. This is the same as assigning $x$ the $y$ associated with $x - v$. Let's construct a function which does just that and call it $f_3(x)$.
If $f(x) = y$,
Then $f_3(x + v) = y$.
Subsequently, $f_3(x) = f(x - v)$
Now, let's say we wanted to combine these concepts at the same time: we want to move a function upwards by $u$ and to the right by $v$ simultaneously.
$$ f_4(x) = f(x - v) + u $$
Now, let's apply this to lines.
$$f(x) = mx + b$$
$$f(x - v) + u = mx - mv + b + u$$
The new equation for your line still has slope $m$, but you have a new $y$-intercept $(-mv + b + u)$.