Can vectors be matrices as well? I am reading this in my text and I'm confused about why matrices and polynomials can be treated as vectors?

Previously, there was an example that looked like this:

So I guess that vectors can be both polynomials and matrices?
My previous reading about vectors is this:

I guess the main idea is that polynomials and matrices are vector spaces which I read about here:

 A: As long as a set of "vectors" satisfies the 10 properties of a vector space in the definition from your textbook, you can treat them as a vector space and apply the theorems of linear algebra to them.  This works because the authors have been careful to use only those 10 properties in proving the theorems of linear algebra.  
In mathematics, it is common to take the most important properties that define something (here vectors in linear algebra) and create a more abstract definition (here it's the definition of "vector space") so that theorems you've already proven can be applied in the more abstract setting.  Now that you've established that sets of matrices and polynomials can be treated as vector spaces, all of the theorems that you've seen for vectors in $R^{n}$ can be applied to those settings as well.   
A: Matrices can be considered as a set of vectors (with agreeing dimensions).
A matrix of dimensions $n$ by $m$ can be considered as a set of $m$ vectors of size $n$ or as $n$ vectors of size $m$.
Polynomials can be considered as vectors that would be multiplied by the canonical base of the polynomials $(1,X,X^2, \cdots, X^n)$ so that $X^2 + 6 = (6,0,1,0,\cdots,0)_B$.
If you want to read more about this, I recommend you to read about tensors (generalized expression of matrices).
A: In short, everything can be vector.
There are two usages of the word "vector."


*

*An absolute (and somewhat informal one), it signifies a quantity with length and direction. This is the first usage that you quote, which is common in applications. Like, velocity is a vector, while mass is a scalar.

*A relative one. This is common in linear algebra. There "vector" just means element of an explicitly or implicitly specified vector-space. This relativeness goes so far that the very same mathematical object can be a "vector" in different ways. 
The source you quote operates with the second one. Both examples you quote explicitly specify the vector space. It says "the vectors in $M_{2,2}$" and "the vectors in $P_2$." It could just as well say "elements" or "objects" instead of "vectors."
You said:

I guess the main idea is that polynomials and matrices are vector spaces which I read about here:

This is exactly right. There is not more to it. The entities you consider are elements of a certain specified vector-space, and you are supposed to work inside that vector-space. 
To reiterate with the second usage, it is crucial that the vector-space is specified as without doing so "is a vector" does not mean anything  as everything is a vector, in the sense that it can be considered as object of some vector-space. 
A related question would be Is arrow notation for vectors "not mathematically mature"? It is at first glance rather different but the underlying issue is the same. 
A: When we talk about vector space, any set with the given properties of a vector space is a vector space and its elements are called vectors.
As you mentioned, a polynomial or a matrix or a complex number could be called a vector if they belong to a vector space.
The set of all continuous functions, for example is a vector space as well as the set of solutions to a homogeneous linear differential equations.   
A: The set of real valued polynomials for example is a vector space. You can check that it verifies all of those conditions in your text book. 
If $f(x) = 3x^2$, and $g(x)= 2x+ 1$ then certainly $f+g$ is a polynomial (for example). 
In this sense we can view polynomials as vectors, because the set of all polynomials is a vector space. Matrices are similar, if you look at the set of all $3\times 3$ real matrices for example you will find that it too satisfies all of the conditions in your textbook for being a vector.
The problem is you've probably learned that vectors have a length and a direction, but what is the length of a matrix? What is the direction of a polynomial?  It isn't a great explanation when you are just learning because it is much harder to picture the length and direction of a polynomial. 
In the most absolute general terms, in order to define a vector space you need a set whose elements obey those properties in your textbook. If you have that then any element in that set we call a vector.
A: At first, I was thinking that your title was wrong, that you meant to ask, "Can matrices be vectors?"  That was because the problem is talking about linear independence of matrices, treating them as elements of a vector space.  So in that sense, the answer is yes, matrices of fixed dimension form a vector space, so the matrices can be regarded as vectors.
On the other hand, vectors can be represented by matrices.  For example, we can represent vectors in the plane by $2\times1$ matrices.  I wouldn't go so far as to say the vectors are matrices, because we can change bases and represent the same vectors with different matrices.  On the other hand, if you fix the basis, say to the natural basis 
$$\left\{\begin{pmatrix}{1\\0}\end{pmatrix},\begin{pmatrix}{1\\0}\end{pmatrix}\right\}$$ then you have only one representation, so you could say the vectors are matrices, if you like.    
