# Generating system of equations with unique solutions

Mathematics Educators Asked on November 17, 2021

I have a similar problem addressed in System of Equations Generator. What I need is an automatic way of generating a system of equations with unique solutions, but the equations are not exclusively linear.

The method of working backwards, by randomly assigning integer values to variables and then generating the coefficients and computing the determinant matrix is perfect for a system of linear equations of the form:

begin{align}x + y = 7\3x – 2y = 6end{align}

I can verify that the solution is unique with x = 4 and y = 3.

Now I would like to add two more operators: multiplication and division. The expected equations would be like this:

begin{align}x + y = 4\2x * y = 6end{align}

How to generate these systems of equations and verify if the solution is unique, assuming integer variables and up to 5 variables? I found a lot of papers about uniqueness in non-linear equations, but I guess my requirement is a little simpler.

If you are looking at intersecting the zero sets of two polynomials in two variables, then by Bezout's theorem you should anticipate that the number of solutions will be equal to the product of the degrees of the polynomials. So in general, you will not get unique solutions. You will need to be very careful to hide these extra solutions "at infinity" or in the complex plane, or as "double roots".

Answered by Steven Gubkin on November 17, 2021

Generating systems. The same method that works for linear equations works also for polynomial equations. Starting with a solution in mind (in mathematics and computer science, we call this a planted solution), generate in some way left-hand sides of equations, and then compute the corresponding right-hand sides. If you use more than one equation per variable then you are likely not to get additional solutions.

Verifying uniqueness. Modern computer algebra systems can find the complete set of solutions of a system of polynomial equations. Under the hood, they might use Gröbner bases.

As an example, in sage you can write

sage: var('x, y')
(x, y)
sage: solve([x + y == 4, 2*x*y == 6], [x, y])
[[x == 1, y == 3], [x == 3, y == 1]]


Sage correctly found the two unique solutions.

Assuming that sage is using Gröbner bases, here is what happens. First, sage computes a Gröbner basis in elimination order.

sage: R.<x,y> = PolynomialRing(ZZ, 2, order = 'lex')
sage: I = ideal(x + y - 4, 2*x*y - 6)
sage: I.groebner_basis()
[x + y - 4, 2*y^2 - 8*y + 6]


It solves the quadratic to find all possible values of $$y$$, substitutes them, and finds the corresponding values of $$x$$. The same idea works with more variables, although the degrees can get quite large.

Answered by Yuval Filmus on November 17, 2021

## Related Questions

### What are the best practices for giving online tests?

6  Asked on September 6, 2021

### How to get better at proofs

6  Asked on September 5, 2021 by occhima

### Logic and proofs in secondary school

2  Asked on September 5, 2021 by rusty-core

### Is There Such Thing as Reaching Half a Standard?

0  Asked on September 5, 2021 by w-g

### How to naturally encounter the properties of identity, commutativity, associativity, and distributivity (to define rings)?

4  Asked on September 5, 2021 by d-r

### Reference Request: Suitability of a text and corresponding video lecture series request for “Matroid Theory”

1  Asked on September 5, 2021

### Do you mention the continuity and the differentiability of the empty function

2  Asked on September 5, 2021

### Would it make sense for math courses to be pass/fail?

2  Asked on September 5, 2021 by lex_i

### What is “mastery” in a mathematical topic?

2  Asked on September 5, 2021

### What is a good place for teachers to share self-created content?

1  Asked on September 5, 2021 by ritesh-singh

### Good resources on matrix equations

2  Asked on September 5, 2021 by razivo

### How much more skilled in the topic should you be in order to teach the topic?

2  Asked on September 5, 2021

### How do I learn advanced mathematics without forgetting?

8  Asked on September 5, 2021 by user14243

### Ramanujan results for middle school?

1  Asked on September 5, 2021

### At what age are most children able to convert between rational fractions and decimals?

4  Asked on September 5, 2021

### How can teachers warn students about common mistakes without causing the student to make the mistake?

7  Asked on September 5, 2021 by user13544

### Create a math quiz with LaTex by randomly choosing questions from a bank

3  Asked on January 19, 2021

### Research for Video Length for Math Videos

1  Asked on January 14, 2021 by cab

### Statistics, for the mathematically rigorous

4  Asked on January 13, 2021 by john-clever