Dimension and base change This is part (f) of Hartshorne, Chapter 2 - Exercise 3.20. I've managed to prove the other parts but stuck on this one.

Suppose $ X $ is an integral scheme of finite type over a field $ k $ (not assumed algebraically closed). If $ k'/k $ is any extension, then show that every irreducible component of $ X' = X \times_{k} k' $ has dimension equal to $ \dim X $.

My try (I don't even know if this is correct): Let $ Z $ be an irreducible component of $ X' $. Since the dimension depends only on the underlying topological space, we may assume that $ Z $ has the reduced subscheme structure, so that $ Z $ is integral. Then by some previous exercises, $ Z $ is an integral scheme of finite type over $ k' $. 
If $ X $ is covered by open affines $ U_i = \text{Spec} A_i $, $ i = 1, \cdots, n $, then $ X' $ is covered by $ V_i = \text{Spec} (A_i \otimes_{k} k') $. Assuming $ Z \cap V_1 \neq \emptyset $, by part (e), $ \dim Z = \dim (Z \cap V_1) $. Now $ Z \cap V_1 $ is a closed integral subscheme of $ V_1 $, so $ Z \cap V_1 = \text{Spec} (A_1 \otimes_{k} k'/Q) $ for some prime ideal $ Q $ of $ A_1 \otimes_{k} k' $. I'm stuck at this point because I have no idea how to compute the dimension of that ring.
The question has been asked before, but I don't really follow the line of arguments there.
 A: We may assume $X$ is affine is possible because we can just run the proof on each affine open of $X$. So fix $X=\operatorname{Spec} A$, and fix an embedding $X\hookrightarrow \Bbb A^n_k$, which is equivalent to choosing generators $R:=k[x_1,\cdots,x_n]\to A$, exhibiting $A$ as $k[x_1,\cdots,x_n]/I$ for some prime ideal $I$. (We know $I$ is prime by the assumption that $X$ is integral.)
In the case that $k\subset k'$ is an algebraic extension, $k[x_1,\cdots,x_n] \subset k'[x_1,\cdots,x_n]$ is an integral extension of normal domains, so it satisfies lying over, incomparability, going up, and going down. This means that every prime ideal of $k'[x_1,\cdots,x_n]$ lying over $I$ fits in to a chain of proper inclusions of prime ideals exactly of the same form. In particular, every irreducible component of $X'$ is of the exact same dimension as $X$.
To handle the case when $k\subset k'$ is not algebraic, it is enough to assume $k$ is algebraically closed. Each irreducible component of $X_{k'}$ lands in an irreducible component of $X_{\overline{k}}$, so we may work component-by-component on $X_{\overline{k}}$ and assume $X_{\overline{k}}$ is irreducible. Similarly, since taking the reduction preserves dimension, we may assume $X_{\overline{k}}$ is integral.
So assume $k$ is algebraically closed. We may also assume $k'$ is algebraically closed by our previous proof. Now the assumption that $X=\operatorname{Spec} k[x_1,\cdots,x_n]/(f_1,\cdots,f_m)$ is integral and affine implies that $X$ is geometrically reduced (see for instance Hartshorne exercise II.3.15 or Stacks 035X), and so $X_{k'}=\operatorname{Spec} k'[x_1,\cdots,x_n]/(f_1,\cdots,f_m)$ is also integral. Now I claim that the transcendence degree of the field of fractions of $X$ and $X_{k'}$ over their base fields are equal: as $x_1,\cdots,x_n$ generate both field extensions, we note that $\operatorname{trdeg} k(X)/k \geq \operatorname{trdeg} k'(X_{k'})/k'$ by selecting a transcendence basis of $k(X)/k$ from the $x_i$ and the  fact that the algebraic dependence relations for the rest of the $x_i$ are polynomials with coefficients from $k$ and thus make sense as polynomials with coefficients from $k'$. On the other hand, if there is a polynomial relation between some of the $x_i$ in the transcendence basis over $k'$, this says that some system of polynomial equations has a solution over $k'$: by the nullstellensatz, this says that it must have a solution over $k$ as well, so the same relation must hold over $k$, showing the reverse inequality.
