Finding the maximum remainder of a division

What is the remainder of the following division:

$$\frac{(x-1)^y + (x+1)^y}{x^2}$$

For what values of $y$ will the remainder be maximized?

(Before anyone asks, NO this is not project euler)

-
What is the domain of $y$? –  Hassan Muhammad Aug 29 '12 at 12:07
@HassanMuhammad Both $x$ and $y$ are positive integers. –  Khaled Aug 29 '12 at 12:12

Assuming $y,x$ a natural number and $x ≠ 0$.

If $y$ is odd, $(x-1)^y+(x+1)^y=2(x^y+^yC_2x^{y-2}+...+^yC_{y-1}x)≡2xy\pmod{x^2}$

Now, $0≤2xy\pmod{x^2}<x^2\implies0≤2y\pmod{x}<x$

If $x$ is odd, the maximum remainder of $2y\pmod{x}$ is $(x-1)$, which will make the remainder maximum $= (x-1)x$.

So, $2y=kx+(x-1)$ will lead to the same maximum remainder, where $k$ any non-negative integer.

If $x$ is even, the maximum remainder of $2y\pmod{x}$ is $(x-2)$ which will make the remainder maximum $=(x-2)x$.

So, $2y=kx+(x-2)$ will lead to the same maximum remainder, where $k$ any non-negative integer .

If $y$ is even, $(x-1)^y+(x+1)^y=2(x^y+^yC_2x^{y-2}+...+^yC_{y-2}x^2+1)≡2\pmod{x^2}$, so the remainder is constant for all even $y$ .

-
LaTeX tip: \implies produces $\implies$ –  user2468 Aug 29 '12 at 13:07
@JenniferDylan, thanks I've utilized it & will do in the future. –  lab bhattacharjee Aug 29 '12 at 13:20