How to solve the quantified equation?

40 Views Asked by At

I have the following equations. I want to solve it for $\forall x.N(x)$

$\forall x.(N(x)-A+Y=0)$

$\forall x.(N(x)^2-2A+A^2=0)$

Where $A,Y$ are integer constants. $N$ is a function return an integer. $x$ is an integer variable.

How to solve the quantified equation?

1

There are 1 best solutions below

0
On BEST ANSWER

The property $\forall x. (N(x) - A + Y = 0)$ can be rewritten as $\forall x. (N(x) = A - Y)$, which tells you that $N(x)$ is constantly equal to $A - Y$.

By replacing $N(x)$ with $A - Y$ in the second property, you obtain the equality $(A - Y)^2 - 2A + A^2 = 0$, which can be rewritten as $Y = A \pm \sqrt{2A - A^2}$.

In order for $Y$ to be well-defined, we must have $2A - A^2 \ge 0$, i.e. $0 \le A \le 2$. Since $A \in \mathbb Z$, there are three possibilities:

  1. $A = 0$, which implies $Y = 0$ and $N(x) = 0$.
  2. $A = 1$, which implies either $Y = 0$ and $N(x) = 1$, or $Y = 2$ and $N(x) = -1$.
  3. $A = 2$, which implies $Y = 2$ and $N(x) = 0$.