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?

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.

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.

  • $\begingroup$ When you say "valid values" do you mean integer values? You can take any real number $x$ and it gives you a value of $y$. For example, $x=\pi$ gives $y=10\pi +1$. Is this not a "valid" value of $y$? $\endgroup$ – saulspatz Apr 22 '18 at 11:08
  • $\begingroup$ No by Integer, i mean whole number which i.e. remove all the decimal part from the number. In simple terms, can i say (y-c) mod m = 0, so how can i easily say by looking at value of y whether above equation would result in 0? $\endgroup$ – SMA Apr 22 '18 at 11:17
  • $\begingroup$ Do you want $x$ to be an integer also, or only $y$? $\endgroup$ – saulspatz Apr 22 '18 at 11:19
  • $\begingroup$ Both would be a whole number. $\endgroup$ – SMA Apr 22 '18 at 11:20
  • $\begingroup$ You should continue to edit the question as it becomes necessary to add details. The later comments aren't even immediately visible when someone visits the question. $\endgroup$ – David K Apr 22 '18 at 11:32

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.

  • $\begingroup$ Thanks that would be much simpler, but that's not my question. If i give you line equation with slope and y intercept what could be the possible integer values of y on the same line with such a slope and y intercept? $\endgroup$ – SMA Apr 22 '18 at 11:07
  • $\begingroup$ Ok what i have written the line is given as $$y=mx+n$$ then you will get with $$x=x_0$$ $$y_0=mx_0+n$$ $\endgroup$ – Dr. Sonnhard Graubner Apr 22 '18 at 11:09
  • $\begingroup$ what if i don't know valid values of x? Can i still predict what could be the valid whole number values of y? something like (y-n) mod m should be 0? $\endgroup$ – SMA Apr 22 '18 at 11:14
  • $\begingroup$ then you will get the $x$-values as $$x=\frac{y-n}{m}$$ if $$m\ne 0$$ $\endgroup$ – Dr. Sonnhard Graubner Apr 22 '18 at 11:16
  • $\begingroup$ Correct. But for that i would need to substitute y and check whether this (y-n) mod m is equal to 0. Can i do it by looking at y by saying y should be of the form m-y-n in order for it to satisfy that condition? $\endgroup$ – SMA Apr 22 '18 at 11:19

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$.

  • $\begingroup$ Exactly what i wanted. The values 1, 11, 21, -9, -19 are the valid values. But rather i need a formula which by looking/substituting 1, 10 in your example i.e. c and m in a line equation, we can tell if that whole number is going to be on line (and not by trial and error basis)? $\endgroup$ – SMA Apr 22 '18 at 11:29
  • $\begingroup$ Can you post me an example for better understanding? $\endgroup$ – Dr. Sonnhard Graubner Apr 22 '18 at 11:38
  • $\begingroup$ @Dr.SonnhardGraubner I'm assuming that your comment was supposed to be addressed to SMA. If not, please tell me what isn't clear. $\endgroup$ – saulspatz Apr 22 '18 at 11:47

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.$

  • $\begingroup$ Thanks! 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 with c and m (let's say you plotted them on graph and have the lines by predicting x values), now if i give you a line say y=(a times x), With this information, is it possible for find how many lines would this line y=(a times x) intersect with? $\endgroup$ – SMA Apr 22 '18 at 11:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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