I was just wondering if there is a way to check that two unknowns are integers as follows:-
if x and y are two values, and I want to know if these two values are integers by using a formula,
I tried adding them and checking if the sum is an integer but I found out that two numbers can be decimal and give integer result (ex. 1.5 + 2.5 = 4), I also tried multiplying them and checking if the product is integer but I found out that two decimals can have an integer product (ex. 1.2 x 2.5 = 3). It's all about checking if x and y both belong to integers and not solving a specific equation.
Summary: "if formula (including x and y) gives a specific result then x and y are integers"
what is the formula ?
NOTE : I want a way that helps in solving equations, so avoid answers like $f(x) = 1 \ \ \ \ \ \ ( x \in \Bbb Z)$. In addition, I don't want to check x and y separately but both at the same time.
There are a lot of functions that meet your criteria.
First, there is this function. It is boring, as it defeats the point of the question, but it is worth noting that it is a mathematically valid function:
1) $f(x, y) = \cases{1 & if $x$ and $y$ are integers \\ 0 & otherwise}$
Similarly, there's
2) $f(x, y) = \{x\} + \{y\}$ where $\{x\}$ denotes the fractional part of $x$. It is 0 iff both are integers.
So it would be a good idea to set some additional restrictions on our functions to have a meaningful question.
A typical restriction could be to ask for functions that are continuous and differentiable (smooth), as most functions and operation we use (addition, subtraction, multiplication, trig, etc.) have this property. Here is a continuous and differentiable (smooth) function that works:
3) $f(x, y) = \sin^2(\pi x) + \sin^2(\pi y)$
This is 0 iff both $x$ and $y$ are integers.
Let's consider continuous and differentiable functions with a bit more generality. Suppose $f(m, n) = k$ for some integers $m$ and $n$. Consider a contour plot line at height $k$. We can then then move slightly along the line, and make $m$ and/or $n$ not integer while preserving the value $k$... Unless $(m, n)$ is a maximum or a minimum, and so the contour line is actually just a point. This means, we need functions that have maxima or minima at every integer point.
This means, there aren't any such functions that can be expressed in terms of only elementary operations (addition, subtraction, multiplication, division, roots).