Boolean equation to check if two integers are equal

106 Views Asked by At

Let $x$ and $y$ be two integers. Which function $f(x, y)$ would result in a $1$ if $x = y$ and $0$ if $x \ne y$?

Examples:

  1. $x=1, y=2, f(x, y) = 0$

  2. $x=4, y=4, f(x, y) = 1$

1

There are 1 best solutions below

0
On

From what I've gathered, the function you need is the Kronecker Delta function, labeled $\delta$ that is simply defined as : $$ \delta_{x,y} = \begin{cases} 0 &\text{if } x \neq y, \\ 1 &\text{if } x = y. \end{cases} $$