From the set $\{1,2,\ldots,n\}$ two numbers are chosen uniformly, with replacement. Find the probability that the product of the numbers is even. The answer is given, just the reasoning is unclear. Result: $${2\over n}\left[{n\over 2}\right]-\left({\left\lfloor{n \over 2}\right\rfloor\over n}\right)^2,\text{ where $\lfloor\cdot\rfloor$ is the whole part of a number}.$$
The second part of the question is: The probability that the sum of the squares of the numbers is even: again the answer: $$1-{2\over n}\left\lfloor{n\over 2}\right\rfloor+{2\over n^2}\left\lfloor{n \over 2}\right\rfloor^2, \text{where $\lfloor\cdot\rfloor$ is the whole part of the number}.$$
 A: First Problem
There are $\left\lfloor\frac{n+1}2\right\rfloor$ odd numbers in $1\dots n$, so the probability that each number chosen is odd is
$$
\frac1n\left\lfloor\frac{n+1}2\right\rfloor
$$
Therefore, the probability that the product is even is
$$
\bbox[5px,border:2px solid #F0A000]{1-\frac1{n^2}\left\lfloor\frac{n+1}2\right\rfloor^2}
$$

There are $n-\left\lfloor\frac{n}2\right\rfloor$ odd numbers in $1\dots n$, so the probability that each number chosen is odd is
$$
\frac1n\left(n-\left\lfloor\frac{n}2\right\rfloor\right)
$$
Therefore, the probability that the product is even is
$$
1-\left(1-\frac1n\left\lfloor\frac{n}2\right\rfloor\right)^2=\bbox[5px,border:2px solid #F0A000]{\frac2n\left\lfloor\frac{n}2\right\rfloor-\frac1{n^2}\left\lfloor\frac{n}2\right\rfloor^2}
$$

Second Problem
There are $\left\lfloor\frac{n+1}2\right\rfloor$ odd numbers and $n-\left\lfloor\frac{n+1}2\right\rfloor$ even numbers in $1\dots n$. Therefore, the number of even-odd draws or odd-even draws is $\left\lfloor\frac{n+1}2\right\rfloor\left(n-\left\lfloor\frac{n+1}2\right\rfloor\right)$. Therefore, the probability of an even sum is
$$
1-\frac2{n^2}\left\lfloor\frac{n+1}2\right\rfloor\left(n-\left\lfloor\frac{n+1}2\right\rfloor\right)
=\bbox[5px,border:2px solid #F0A000]{1-\frac2n\left\lfloor\frac{n+1}2\right\rfloor+\frac2{n^2}\left\lfloor\frac{n+1}2\right\rfloor^2}
$$

There are $n-\left\lfloor\frac{n}2\right\rfloor$ odd numbers and $\left\lfloor\frac{n}2\right\rfloor$ even numbers in $1\dots n$. Therefore, the number of even-odd draws or odd-even draws is $\left\lfloor\frac{n}2\right\rfloor\left(n-\left\lfloor\frac{n}2\right\rfloor\right)$. Therefore, the probability of an even sum is
$$
1-\frac2{n^2}\left\lfloor\frac{n}2\right\rfloor\left(n-\left\lfloor\frac{n}2\right\rfloor\right)
=\bbox[5px,border:2px solid #F0A000]{1-\frac2n\left\lfloor\frac{n}2\right\rfloor+\frac2{n^2}\left\lfloor\frac{n}2\right\rfloor^2}
$$
A: Probability that you are looking for is equal to $1 -$ probability of product being odd.
Product is odd if both numbers are odd.
Probability of a number being odd is $1 - \dfrac{[\frac{n}{2}]}{n}$.
Probability of both being odd is $\left(1 - \dfrac{[\frac{n}{2}]}{n}\right)^2$.
Square it and you get the probability for odd product to be: $1 - 2\dfrac{[\frac{n}{2}]}{n} + \left(\dfrac{[\frac{n}{2}]}{n}\right)^2$
Even  product is, to remind you: $1 -$ prob. of odd
Therefore $1 - \left(1 - \dfrac{2[n/2]}{n} + \left(\dfrac{[n/2]}{n}\right)^2\right)$
Result: $2\dfrac{[\frac{n}{2}]}{n} - \left(\dfrac{[\frac{n}{2}]}{n}\right)^2$
