I was reading an article that said: if I have a finite field, say $\mathbb{F}_q^k$ where $q=p^n$ and $p$ is a prime; and a (k-2)-dimensional subspace, say $U\subset \mathbb{F}_q^k$ given by the span of $k-2$ linearly independent vectors of $\mathbb{F}_q^k$, then there exists $q+1$ hyperplanes in $\mathbb{F}_q^k$ that contains $U$. Why this is true? I mean, If I take every subset of $A\subset \mathbb{F}_q^k$ such that $A=U\cup \{x\} $ where $x\in \mathbb{F}_q^k$ and $x$ is linearly indep. with all vectors who spanned $U$ then $A$ will be a hyperplane such that $U\subset A$ and we can build more than $q+1$ hyperplanes like $A$...
thanks for help
Recall the bijection between $\{ \mbox{hyperplanes of $\Bbb{F}_q^k$ containing $U$} \}$ and $\{ \mbox{hyperplanes of $\Bbb{F}_q^k/U$} \}$.
In particular, $\Bbb{F}_q^k/U$ is a $2$-dimensional $\Bbb{F}_q$-vector space, hence hyperplanes of $\Bbb{F}_q^k/U$ are as many as lines (subspaces of dimension $1$) in $\Bbb{F}_q^2$.
A line is spanned by some vector of the form $(1,x)$ with $x \in \Bbb{F}_q$ (this gives us exactly $q$ lines), or it is the line spanned by the vector $(0,1)$.
So you have exactly $q+1$ hyperplanes containing $U$.
Your mistake is saying that $U \cup \{ x \}$ is a subspace. This is obviously false, since you have $x+x \notin U \cup \{ x \}$ (in general), so this is not closed under addition.