# How to create an equation of a given form with integer coefficients and variables

A math textbook gives the following problem: What is the solution of 3(2x-1) – 2(3x+4) = 11x. The solution is an integer.

Using Excel to choose some numbers at random and compute the remaining numbers, I want to create problems like that one, with coefficients and solutions that are integers. Rightly or wrongly, I’ve conceptualized my task like this:

• a(bx + c) + d(ex + f) = gx
• abx + ac + dex + df = gx
• ac + df = - abx - dex + gx
• ac + df = (-ab - de + g)x
• (ac + df) / (-ab - de + g) = x

So if we arbitrarily choose values of a, b, d, e, g and x, we can solve for the numerator. For example, if a=2, b=3, d=5, e=7, and g=11, then the denominator is -30. If we choose x=3, then the numerator is 3*(-30) = -90.

• (ac + df) = -90
• 2c + 5f = -90

Somehow I’m stuck on that last step. How do I pick values of c and f so that this works? Of course I don’t want just an example of values of c and f that solve here, but a general approach that will give values that are integers.

Or can you suggest a better approach to the original problem?

• At 2c+5f=-90 you are solving a "Linear Diophantine Equation". Google that and you'll find lots of resources, such as this video: youtube.com/watch?v=xkoKAHQ0RZI Aug 24 at 19:10
• Another approach would be to choose a,b,c,d,e and f first and then find a g such that -ab-de+g divides ac+df. Aug 24 at 19:13
• I'd propose to fix $g=1$, and then $ab+de = 0$. This is relatively easy because you just need multiples: $a = kd,\quad e= -kb$ seems to be pretty straightforward. Aug 24 at 20:52
• @Aeryk I agree: that is another approach. Do you see an advantage in it? Aug 24 at 22:59
• @Chaim The advantage is that you don't have to use Bezout's Identity to solve for g. I guess you need to be able to find divisors of ac+df which theoretically might not be easy, but for small numbers should be in practice. Aug 25 at 13:54

Your $$2 c + 5 f = -90$$ can be solved using Bézout's identity: As $$\gcd(2, 5) = 1$$, you know that there are $$2 u + 5 v = 1$$ (for example, $$u = 3, v = -1$$), and manufacturing your $$c, f$$ if trivial, $$c = u \cdot (-90) = -180, f = v \cdot (-90) = 90$$. Replacing in the first equation this gives you a similar equation for $$a, d$$.

• I think I follow you up to the second equation, but (1) that second equation has the same form as the first, and I don't know how Excel would solve either; and (2) I don't understand the balance at all. Your words "and manufacturing your c, f if trivial" mean that it's easy to find interger solutions? I don't find it easy; it is the original question. How did you use the values u=3, v=−1? Aug 24 at 23:40

Your approach to automating the product of such problems seems workable, but it does require you take care to remember all the details of your set-up. Let me suggest a far less clever, but very portable method.

1. Stand in front of board.
2. Write the solution you want, let's say $$x= 13$$.
3. Write an arithmetic sentence which is true off the top of your head like: $$3(13+1) = 42 = 26+16 = 2(13) + 16$$
4. You don't let the class see what I wrote above, you then write: $$3(x+1) = 2x+16$$
5. Erase the evidence and turn around, ask them to solve it.

If you didn't make a mistake the answer is $$x=13$$. If you did make a mistake, bluff, it's still a legit algebra problem to solve.

Added: or if you must have an equation of the particular form the OP desired, $$3(-2\cdot 13+10)+4(3\cdot 13-1) = 8 \cdot 13$$ hence the equation: $$3(-2x+10)+4(3x-1) = 8x$$ The idea can be used to create equations of most any form we desire. Simply begin with the answer and work backwards.

• That equation 3(x+1)=2x+16 does not have the required form a(bx + c) + d(ex + f) = gx. Aug 24 at 22:52