The Dimension of the Symmetric $k$-tensors

I want to compute the dimension of the symmetric $k$-tensors. I know that a covariant $k$-tensor $T$ is called symmetric if it is unchanged under permutation of arguments. Also, I know that the dimension of covariant $k$-tensors is $n^k$ but how can I eliminate non-symmetric the cases? I found this but I could not get the intution. Also, this blog post answers my question but I don't see why we put | between different indices. Any concrete example would also help such as the symmetric covariant 2-tensors in $\mathbb{R^3}$, as I asked in this thread.


A basis for symmetric tensors, say $\otimes_1^r V$ with $\{v_1,...,v_n\}$ a basis for $V$, is given by the symmetrizations of $\{v_{i_1}\otimes ... \otimes v_{i_r} \ | \ 1\leq i_1\leq...\leq i_r\leq n\}$. so you must count the number of non-decreasing sequences (repetitions allowed) of length $r$ with entries in $[1,n]$. I've always heard the method of counting these referred to as stars and bars, i.e. counting the number of multisets of size $r$ with entries from $[1,n]$, and the answer you get is ${n+r-1\choose r}$.


You line up $r$ stars and insert $n-1$ bars, the first bar separating indicies 1 and 2, the second bar separating indicies 2 and 3, ..., the $(n-1)$st bar separating indicies $n-1$ and $n$.

For example, say $r=5$ and $n=3$. Here are some example of non-decreasing sequences of length $r=5$ with entries from $\{1,2,3\}$: \begin{align*} 11223 \ &: \ **|**|*\\ 22333 \ &: \ |**|***\\ 11122 \ &: \ ***|**|\\ 22222 \ &: \ |*****|\\ \end{align*} So there are $r+n-1$ ``things'' (stars and bars) and you're choosing $r$ of them to be stars (or $n-1$ of them to be bars).


As for why this determines a basis for symmetric tensors: any pure tensor on the chosen basis determines a symmetric tensor via $$ S(v_{i_1}\otimes ... \otimes v_{i_r})=\sum_{\pi\in S_n}v_{\pi(i_1)}\otimes ... \otimes v_{\pi(i_r)} $$ and two pure tensors have the same symmetrization if their indices determine the same multiset (i.e. non-decreasing sequence as described above). I'll leave it to the reader to show that these are independent and that they span the space of symmetric tensors. (On a technical note, the symmetrization needs to be modified in non-zero characteristic and some sources might divide by $n!$.)