IDNLearn.com offers a unique blend of expert answers and community-driven knowledge. Find the solutions you need quickly and accurately with help from our knowledgeable community.

For an integer n ≥ 0, show that (n/2) - (-n/2) = n.

Use greatest integer function


Sagot :

The greatest integer function returns the largest integer smaller than the number you provide it. That is, if n ≤ x < n + 1, where n is an integer, then the "greatest integer of x" is [x] = n.

• Let n be even. Then we can write n = 2k for some integer k ≥ 0. Now,

[n/2] = [k] = k

while

[-n/2] = [-k] = -k

so that

[n/2] - [-n/2] = 2k = n

• Let n be odd. Then n = 2k + 1 for some integer k ≥ 0. Every odd integer occurs between two even integers, so that

n - 1 < n < n + 1

or equivalently,

2k < n < 2k + 2

so that

k < n/2 < k + 1

It follows that [n/2] = k.

Similarly, if we negative the previous inequality, we have

-k > -n/2 > -(k + 1), or -k - 1 < -n/2 < -k

which means [-n/2] = -k - 1.

So we make the same conclusion,

[n/2] - [-n/2] = k - (-k - 1) = 2k + 1 = n