How can I determine the relationship between some variables in an expression so that the final result is always a natural number?

73 Views Asked by At

In a current project that I am working on, I have to determine relationship between various variables so that the final result I get by solving the equation is a natural number.

For example, one such equation is

$$\frac{(D_2*B_2 - D_1*B_1)}{(D_1*M_1 - D_2*M2)}$$

All the variables in this case are natural numbers. I have to find a condition between them such that the final result after division is also a natural number.

Can this be done at all? If it is doable, could anyone please provide some insights on how I should proceed?

Even though there are no other constraints on the variables, we can add the constraints ourselves. For example, $D_1$ could always only be a multiple of 5 etc.

Thanks.

1

There are 1 best solutions below

4
On

The expression $$\frac{D_2B_2 - D_1B_1}{D_1M_1 - D_2M2}$$ is a positive integer if and only if there is some positive integer $k$ such that $$D_2B_2 - D_1B_1 =k(D_1M_1 - D_2M2).$$ There's no more to it than that apart from the constraints pointed out by @TheIntegrator namely either $D_2B_2>D_1B_1,D_1M_1>D_2M2$ or $D_2B_2<D_1B_1,D_1M_1<D_2M2$.

Your choice of $k$ depends on additional information about what you're trying to do with that expression. For example, we cannot specify possible values of $k$ further unless one knows what the letters in the expression represent, or one has another relationship between them.