0

Trying to solve this for practice.

$f(x)=x^2+x+1$ find all values of $f(x) \% 5$. $f(x) \in \mathbb{N}$

Would I be able to get walked through how to do it. Currently I've just found a set of what I believe to be all possible solutions through trialing inputs (Giving me a repeating pattern of $1,2,3,2,3$), however how would I construct a formal proof from this?

Thanks

MathsNoob
  • 117

1 Answers1

3

I'll expand on Asher2211's comment. If $x \in \mathbb{N}$ then $x \in \{5n +k \vert k =0,1,2,3,4 \land n \in \mathbb{N}\}$. This gives us $5$ possible cases:

  1. $$ f(x) = \left( 5n \right)^2 + \left( 5n \right) +1 = 5\left[ 5n^2 +n\right] +1 \equiv 1 \bmod 5 $$
  2. $$ f(x) = \left( 5n+1 \right)^2 + \left( 5n +1\right) +1 = 5\left[ 5n^2 +3n\right] +3 \equiv 3 \bmod 5 $$
  3. $$f(x) = \left( 5n+2 \right)^2 + \left( 5n +2\right) +1 = 5\left[ 5n^2 +5n+1\right] +2 \equiv 2 \bmod 5 $$
  4. $$f(x) = \left( 5n+3 \right)^2 + \left( 5n +3\right) +1 = 5\left[ 5n^2 +7n+2 \right ] +3 \equiv 3 \bmod 5 $$
  5. $$ f(x) = \left( 5n+4 \right)^2 + \left( 5n +4\right) +1 = 5\left[ 5n^2 +9n+4\right ] +1 \equiv 1 \bmod 5 $$

Since we didn't find one possible case where $f(x) \equiv 0 \bmod 5$, then we can say $f(x)$ is never a multiple of $5$ for all $x \in \mathbb{N}$.


Using Bill Dubuque's comment you can obtain a simpler argument of the above. Since $5n + k \equiv k \bmod 5$ implies $f(5n+k) \equiv f(k) \bmod 5$, the $5$ cases could have been reduced to just checking $f(0), f(1), f(2), f(3)$ and $f(4)$, where you would arrive at the same conclusion.

Robert Lee
  • 7,233
  • Just realised I forgot the \ before the $%$ so it messed up my question. Could you please take another look? Thanks heaps – MathsNoob Jun 04 '21 at 01:37