$P_n(x,y)$ denote the vector space of polynomial with degree less than equal to $n $, then $\dim (P_n(x,y))=\frac{(n+1)(n+2)}{2!}$ $P_n(x,y)$  denote the vector space of polynomial with degree less than equal to $n $, then $\dim (P_n(x,y))=\dfrac{(n+1)(n+2)}{2!}$
How this answer is coming?
My attempt,
Total base elements (of degree${}=n)= n+1$
Total base elements (of degree${}=n-1)= n$
$\ldots$
Total base elements (of degree${}=1)= 2$.
Therefore total possible base elements${}=\dfrac{((n+1)+1)(n+1)}{2}$
Am I Right? 
How to generalize the formula. Please explain.
 A: In general, the space of polynomials in $k$ variables having degree $\le n$ has the basis:
$$\{x_1 ^{a_1} \cdots x_k^{a_k}: \sum_{i=1}^k a_i \le n\}$$
which is the same as the set:
$$\{1^{a_0} x_1^{a_1} \cdots x_k ^{a_k}: \sum_{i=0}^k a_i = n\}$$
Using stars and bars, the cardinality of this set (hence the dimensionality of the vector space) is:
$${n + k \choose n}$$
A: Hint you have to find the numbers of $x^iy^j$, $i+j\leq n$, for $i=0$ you have $n+1$ choices for $j$,... for $i=n$ you have one choice, so in total you have:
$$0+1+\cdots+n+1={{(n+1)(n+2)}\over 2}.$$
A: The univariate polynomial ring $k[x]$ has dimension $n+1$ with basis $\{1,x,\dots,x_n\}$.
For each one of these basis vectors $x^i$, we can multiply by $y^j$ with $j \leq n-i$.
For the first one $x^0$, this is $n$ vectors (any power of $y$), then $x^1$, we can mulyiply $n-1$ vectors, etc.
From this, we get that the dimension is $\sum_{k=0}^{n+1} n-k=\sum_{k=0}^{n+1} k=(n+1) \cdot (n+2)/2$.
here is a generalization using stars and bars-- the basic idea is you just want to find out how many different monomials you can have so that the sum of their exponents ((total degree) is less than $n$ 
A: $$
\begin{array}{cccccccc}
& a_{0,0} & + & a_{0,1} x & + & a_{0,2} x^2 & + & a_{0,3} x^3 \\
& & & & & & \swarrow \\
+ & a_{1,0} y & + & a_{1,1} xy & + & a_{1,2} xy^2 \\
& & & & \swarrow\\
+ & a_{2,0} y^2 & + & a_{2,1}xy^2 \\
& & \swarrow \\
+ & a_{3,0} y^2
\end{array}
$$
The arrows link terms of degree $3.$
Another diagonal sequence of arrows, parallel to this one, would link terms of degree $2.$
And yet another of terms of degree $1,$ just two of those in this case.
So the number of coefficients is the "triangular number" $1+2+3+4,$ and $4$ is just $1$ more than the degree.
In other words, your reasoning is correct.
