Member-only story

If x+y=50, x-y = 10, what is the value of x and y?

Crack this question with machine learning!

Shuai Li
3 min readJul 24, 2023

This Sunday, My nephew, an elementary school boy, hurried up to me.

“Uncle, how to solve this problem?” He handed me his math exercise book and asked.

As the title mention, the question is:

x+y=50

x-y = 10

What is the value of x and y?

Hmm, upon seeing this question, I instantly furrowed my brows and exclaimed: Have elementary school math problems become this difficult?

However, luckily, it seems this problem can be solved using machine learning algorithms. So, I said to my nephew: This problem is difficult, you can go play for a while, and I’ll teach you after I solve it.

At present, we don’t know the values of x and y, but we can assume that their values are x_predict and y_predict.

There is a deviation between our predicted values and the actual values. This deviation, or what we call the loss function, is:

loss = (x_predict + y_predict-50) ^ 2 + (x_predict * y_predict — 10) ^ 2

Or in Python code:

def loss(x_predict, y_predict):
return (x_predict +…

--

--

Shuai Li
Shuai Li

Written by Shuai Li

An enthusiastic game player of Earth Online.

Responses (2)