Is it wrong to deduce the premise from the conclusion? My professor gave me the following argument to prove:


  Let $x$ be an even number. Then $x+x^2$ must be an even number.


I wrote down the following:


  Hypothesis: $x = 2n$ for some $n\in \mathbb{Z}$
  Thesis: $x + x^2 = 2m$ for some $m \in \mathbb{Z}$
  
  Let us consider a direct proof.
  
  $x+x^2=2m$ (replacing $x=2n$)
  $2n + 4n^2=2m$
  $2(n + 2n^2) = 2m$ (since $n\in\mathbb{N}$, we can replace $m=n+2n^2$)
  2m = 2m


My professor says I only proved the converse (that if $x+x^2$ is even, then $x$ must be even) I claimed that showing that I can reach an identity from any equation using the act that $x=2n$ suffices as a formal proof, but he wasn't convinced. How can I prove I'm right?
Consider the invalid statement: "Let $x$ be a bird. Then $x$ is a duck."

Now, your approach is to assume the consequent, that $x$ is a duck, then demostrate that the duck is a bird, and decide that the statement was valid.  Opps.

So, no, affirming the consequent is a falacy.
sorry it's not clear if the universe of discourse is natural numbers or integers since you reference both.

Assuming integers:

if $ x $ even -> $ (x + x^2) $ even.

because you're given that x is even, pretend $ \exists i \in \Bbb Z (x=2i) $

you need to show that $ \exists j \in \Bbb Z  (x^2 + x = 2j) $

$$ x = 2i $$
$$ x^2 = 4i^2 $$
$$ (x^2 + x) = 4i^2 + 2i = 2j $$
$$ j = 2i^2 + i $$