1

Problem description

Having system of equations as input (in whatever format):

x + y = 6
2x + y = 9

I would like to output manual, step-by-step high-school-like solution. In other words applying rules from a ruleset one at a time:

Step 1: 
x = 6 - y
2x + y = 9
Step 2:
x = 6 - y
2 * (6 - y) + y = 9
Step 3:
x = 6 - y
12 - 2y + y = 9
Step 4:
x = 6 - y
-2y + y = 9 - 12
Step 5:
x = 6 - y
-y = 9 - 12
Step 6:
x = 6 - y
-y = -3
Step 7:
x = 6 - y
y = 3
Step 8:
x = 6 - 3
y = 3
Step 9:
x = 3
y = 3

Let's assume that system is always solvable. I'm trying to write this program in Node, but underlying technology is a secondary issue.

Question

Is there some terms rewriting system / expert system which can do this? Or is this problem more complex then I think and there is no simple, automated solution?

  • Only simple linear equations like the one in this example? Or different types? – Doc Brown Feb 26 at 21:59
  • Only simple equations like above + parenthesis and integer powers. The most complicated ones should look like this: (x - 2)^2 + x^4 = 17 + y – M. Twarog Mar 2 at 12:08
  • 1
    For linear equations - like the one in your question - one could use the standard Gaussian elimination. For polynomial equations, however, like the one in your comment, there may not even be a solution, or it may only be possible to find a symbolic, closed solution, only a numerical one. I would recommend to google for "polynomial equation solver". What you are asking for might be part of some computer algebra systems, check this list on Wikipedia – Doc Brown Mar 2 at 12:22

Your Answer

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

Browse other questions tagged or ask your own question.