Is this a valid proof that $\sqrt{2}$ is irrational? According to this math.stackexchange thread
A number is a perfect square if and only if its prime factorization contains only even exponents. 
The prime factorization of $2 = 2^1$.
Therefore, the prime factorization of $2$ contains an odd exponent so $2$ is not a perfect square.
Thus, $\sqrt{2}$ is irrational.
Is this a valid proof?
 A: ....

Therefore, the prime factorization of 2 contains an odd exponent so 2 is not a perfect square.

Right. But that only goes to prove that if $\sqrt{2}^2 = 2$, then $\sqrt{2}$ is not an integer.  We need to prove it is not a rational number.
And if you want to use your theorem:
If $\sqrt{2} = \frac ab$ where $a$ and $b$ are integers, means that $2 = \frac {a^2}{b^2}$ which means that $2b^2 = a^2$.
Now $b^2$ is perfect square.  So it's prime factorization has only even powers.  So the power of $2$ that factors into $b^2$ is even.  (If $b$ is odd then $0$ is an even number).  So the power that divide into $2b^2$ will be $1$ higher.  
So the power of $2$ that divides into $2b^2$ is odd.  So $2b^2$ is not a perfect square.  
But $2b^2 = a^2$ so it is a perfect square.
That's a contradiction. So our assumption that there are integers $a,b$ so that $\sqrt{2}=\frac ab$ can't be true.  So $\sqrt{2}$ is not rational.
.....
Or maybe our theorem that A number is a perfect square if and only if its prime factorization contains only even exponents is incorrect.
It is correct and we can use it but we do have to prove it before we take it for granted.
..... PS .....
Note:  By your theorem for any prime $p$ then and integer $n$ we can see $pn^2$ is not a perfect square and indeed of any non-square $j$ then $jn^2$ can not be a perfect square.
..... PPS......
Throughout all of this we assume that there is such a thing as "$\sqrt{2}$".  There might not be.  After all if we are dealing with real numbers there is no such thing as $\sqrt{-1}$.  And if we are dealing with complex numbers there is no such thing as $\sqrt{\text{Babar, the elephant}}$.
It doesn't matter now, but later it will.  
Our proof isn't really that "$\sqrt{2}$ is irrational" but that "if we define $\sqrt{2}$ as the number $r$ so that $r^2 = 2$ then either $\sqrt{2}$ does not exist at all or that $\sqrt{2}$ is irrational", or to put in more legitimately "There is no rational number $r$ so that $r^2 = 2$".
To prove that there is a real number $r$ so that $r^2 = 2$ is a whole other kettle of fish.
A: For such a conclusion to be established, you need to prove why $\sqrt{a}$ is always irrational whenever the prime factorization of $a$ has an odd exponent, where $a$ is a positive integer greater than $1$. (Remember a unique prime factorization is guaranteed for every positive integer by Fundamental Theorem of Arithmetic)
Let's assume:
$$\sqrt{a}=\frac{p}{q}\ \{\gcd(p,q)=1\ \&\ p,q\ \in\ \mathbb{Z}^+\}$$
Here we are assuming $\sqrt{a}$ is rational and so must have a simplest form. Thus:
$$\Rightarrow a=\frac{p^2}{q^2}\Rightarrow p^2=aq^2 $$
Since $p^2$ must have a prime factorization with only even exponents, $a$ must be have a prime factorization with only even exponents too. If we had defined $a$ as a natural number that is not a perfect square and has an odd exponent in its prime factorization than such a situation is absurd (Reductio ad absurdum) and we have proved what we set out to using proof by contradiction. Now let's say $a$ is prime (in the case of $a=2$) we can take the proof further by writing:
$$\Rightarrow a |\ p^2 \Rightarrow a |\ p$$
The last statement can be proved using the Fundamental Theorem of Arithmetic. Its proof is given elsewhere in stackexchange. Now that we know $a|\ p$, $p$ must be of form $ak$ for some $k\ \in\ \mathbb{Z}^+$. Thus:
$$p^2 = aq^2 \Rightarrow a^2 k^2 = aq^2 \Rightarrow q^2 = ak^2 (\because a \neq 0)$$
$$\Rightarrow a\ |\ q^2 \Rightarrow a\ |\ q \Rightarrow a\ |\ \gcd (p,q)\ (\because a\ |\ p) \Rightarrow a\ |\ 1 \Rightarrow a=1$$
But we had defined $a$ to be a positive integer greater than 1. Reductio ad absurdum.
Therefore $\sqrt{a}$ can only be rational if $a$ is a perfect square.
A: As it stands, your argument is not a full proof.
However, unique factorization is strong and can easily prove that $\sqrt2$ is irrational. But sometimes we want a proof that does not use such an "expensive" theorem.
But to repair/complete your proof, you could generalize the fact from the other thread (which I think was about whole numbers only) into something like:

A rational number $a$ is the square of some (other) rational number
  if and only if (after reducing the fraction $a$ to lowest terms if necessary)
  the prime factorizations of both the numerator of $a$ and the denominator of $a$
  contain only even exponents.

If we take unique factorization (fundamental theorem of arithmetic) for known, it is easy to prove this statement. (Go ahead.)
Then write "two" as $a=\frac21$. While the denominator $1$ is OK (all primes are to the zeroth power, and zero is even), the numerator $2=2^1$ has an odd exponent, and so $\frac21$ is not the square of any fraction.
