# How do a system of four equations with Python?

• The need to find a solution to the system is to provide an example of such a combination of natural numbers r, b, y, p, to be followed by the following equation system.

(r + b + y) = 12
(r + b + p) = 16
(r + y + p) = 14
(y + b + p) = 24


We know this combination is one.

• For example, almost in the forehead, but quicker:

for r in range(-100, 100):
for b in range(-100, 100):
y = 12 - r - b
p = 16 - r - b
if r + y + p == 14 and y + b + p == 24:
print(b, p, r, y)


In fact, the task on paper is:

1. We're folding all equations and getting

 (r + b + y) + (r + b + p) + (r + y + p) + (y + b + p) = 12 + 16 + 14 + 24
3r + 3b + 3p + 3y = 66
r + b + p + y = 22

2. further deduct from the equation all equations and variables are obtained:

 (r + b + p + y) - (r + b + y) = 22 - 12
p = 10
(r + b + p + y) - (r + b + p) = 22 - 16
y = 6
(r + b + p + y) - (r + y + p) = 22 - 14
b = 8
(r + b + p + y) - (y + b + p) = 22 - 24
r = -2


2

2

2

2

2

2

2

2

2

2

2

2

2

2

2