Valid integer values of y axis given slope and y intercept

857 Views Asked by At

Is there a simpler way where i could find all the valid values of y if i'm given y intercept as a whole number and a slope of line as a whole number in a line equation?

So for example, my line equation y = mx+c, i would be given c and m, how could i find a valid whole number for y which would satisfy my line equation?

So if c = 1, m = 10, my equation would be (y-1)/10 = x. Now valid values of y would be 11, 21, 31 etc. Is there a simpler way or any formula for the same?

To make it simpler, if am given m, c for multiple lines on a 2d plane, and now if i give you a whole number indicating value of y, can i find out which all line would this y value intersect with from all the above lines? Is there any formula which i could apply to get to know all the lines that it intersect with?

EDIT
I know (y-c) mod m would let me know if y is the possible solution or not. If let's say i give you multiple lines (let's call it as a given lines) with c and m (both whole number) for those different lines (let's say you plotted them on graph by calculating x intercept).

Now if i give you say another line equation of the form y=(a times x), With this information, is it possible to know, how many of the given lines would this line y=(a times x) intersect with?

So let's take an example. Consider we are given two lines (a.k.a. given lines) as below:

           c    m
line 1 =>  1    0
line 2 =>  2    0

Now i have two equations:

y=x,  ----- let's call this as Equation 1
y=2x, ----- let's call this as Equation 2

I know for the fact as below:

  • Equation 1 intersect at (1,1) with given line 1
  • Equation 2 intersect at (0.5, 1) with given line 1. We don't need this as it intersect at real number.
  • Equation 1 intersect at (2,2) with given line 2
  • Equation 2 intersect at (1, 2) with given line 2.

Is there a simpler way rather than going through each line to find number of lines that this equation of line would intersect with at x and y co-ordinate represented as a whole number?

So as can be seen above, equation 1, intersect with just one of the given lines, while equation 2 intersects with both the given lines.

Note:
It is not necessary that given equation needs to intersect with all the given lines. Also it may be possible that line may not intersect with any of the given lines which is fine.

3

There are 3 best solutions below

7
On

Note that if we have given $$m,c$$ then we get Points of the form $$(x;mx+c)$$ for example $$x=2$$ then we have $$(2,m2+c)$$ The same for your second question, Points are $(x;10x+1)$ for example: $$x=10$$ so $$10\cdot 10+1=101$$ and so on.

3
On

You question is how to find the integer solutions to the equation $y=10x+1.$ This is called a linear Diophantine equation. In this case, we would consider the equation already solved when given in the form $y=10x+1$ because if you plug in an integer value for $x$ you get an integer value for y. The only solutions are $1, 11, 21, \dots$ and $-9, -19, -29, \dots$

It gets more complicated when the coefficients of both variables are different from $\pm 1$ or when you have more than two variables, or more than one equation.

EDIT If I understand your comment right, the criterion you want is that $y-1$ is divisible by $10$. Again, you had this already when you said, $$\frac{y-1}{10}=x.$$ If $x$ is an integer, then the equation says just what I said above: $10$ is a divisor of $y-1$.

1
On

The equation

$$ y = mx + c $$

is equivalent to

$$ y - c = mx.$$

You can therefore use the following method to determine whether a given number $y$ is a possible solution:

  1. Subtract $c$ from $y,$ that is, compute $y - c.$
  2. Divide $y - c$ by $m.$ Don't bother with digits after the decimal part if the result doesn't come out to an exact integer.
  3. $y$ is a possible solution if, and only if, the result of the division was an exact integer.

If you want to know whether two lines intersect at an integer point, where the equations of the lines are $ y = m_1x + c_1 $ and $ y = m_2x + c_2, $ then you can first determine whether $m_1x + c_1 = m_2x + c_2$ at an integer value of $x$; that is, whether the equation

$$ 0 = m_1x + c_1 - ( m_2x + c_2 ) = (m_1 - m_2)x + (c_1 - c_2) $$

has a solution for integer $x.$ A solution exists if and only if $c_1 - c_2$ is divisible by $m_1 - m_2.$

If $c_1 - c_2$ is not divisible by $m_1 - m_2,$ you're done with that pair of lines; there is no solution. But if you get an integer result $x$ from

$$ x = \frac{c_1 - c_2}{m_1 - m_2}, $$

then when you substitute $x$ into either $ y = m_1x + c_1 $ or $ y = m_2x + c_2, $ you will get the same value of $y$ and it will be an integer.

In summary: the lines $ y = m_1x + c_1 $ and $ y = m_2x + c_2 $ intersect at an integer point if and only if $c_1 - c_2$ is exactly divisible by $m_1 - m_2.$