Recall that a [$q$-Pochhammer symbol](https://en.wikipedia.org/wiki/Q-Pochhammer_symbol) is defined as
$$
(x)\_n = (x;q)\_n := \prod\_{l=0}^{n-1}(1-q^l x).
$$


I found the following curious $q$-series identity that seems to hold for any $n\geq 0$:
$$
(-1)^{n+1}q^{\frac{(n+1)(3n+2)}{2}}\sum\_{j\geq 0}q^{j}(q^{j+1})\_{n}(q^{j+2n+2})\_{\infty} \overset{?}{=} \sum\_{\substack{k\in \mathbb{Z}\\ |k| > n}}(-1)^{k}q^{\frac{k(3k-1)}{2}}.
$$
Note, the right-hand side is a truncated version of the [Euler function](https://en.wikipedia.org/wiki/Euler_function)
$$
\phi(q) := (q)\_{\infty} = \sum\_{k\in \mathbb{Z}}(-1)^{k}q^{\frac{k(3k-1)}{2}}.
$$


How can we prove the above identity? Any suggestions/ideas would be greatly appreciated!



A curious $q$-series identity on a truncated Euler function
Let ${n\choose k}\_q=\frac{(q)\_n}{(q)\_k(q)\_{n-k}}$ denote a $q$-binomial coefficient. We start with the following version of $q$-Vandermonde convolution identity:
$$
(x-y)(x-qy)\ldots(x-q^{n-1}y)\\=\sum\_{k=0}^n(-1)^{k}q^{k(k-1)/2}{n\choose k}\_q(y)\_{n-k}(xq^{1-k})\_k\quad\quad(\diamondsuit)
$$
A short proof of $(\diamondsuit)$ may be obtained by checking it when $x=q^i$, $y=q^{-j}$ for non-negative integers $i,j$ such that $i+j\leqslant n$. In these points the values of both sides of $(\diamondsuit)$ are equal to 0, unless $i+j=n$ and we take the summand with $k=i$ in the right hand side. At this point, the identity is staightforward. It remains to observe that this collection of points is enough for reconstruction of the polynomial of degree at most $n$.


We apply $(\diamondsuit)$ for $y=q^{n+1}$, $x=tq^{2n+1}$ and multiply both sides by $-q^{2n+1}$. This gives, denoting for $k=0,1,\ldots,n$
$$
c\_k:=(-1)^{k+1}{n\choose k}\_qq^{k(k+1)/2}(q^{n+1})\_{n-k},
$$
the following identity:
$$
(-1)^{n+1}q^{(n+1)(3n+2)/2}(qt)\_n\\=c\_0q^{2n+1}+c\_1q^{2n}(q^{2n+1}t)\_1+c\_2q^{2n-1}(q^{2n}t)\_2+\ldots+c\_{n}q^{n+1}(q^{n+2}t)\_n. \quad \quad (\heartsuit)$$


Denote now $s\_n=(q^n)\_\infty=\prod\_{k\geqslant n}(1-q^k)$. Note that $$\sum\_{k\geqslant n}q^ks\_{k+1}=\sum\_{k\geqslant n}(s\_{k+1}-s\_k)=1-s\_n.\quad\quad(\clubsuit)$$ The idea is to reduce your sum to such telescoping sums.


Applying $(\heartsuit)$ for $t=q^j$ and multiplying by $q^j$ and using $(\clubsuit)$, your sum reads as
$$
S=\sum\_{i=0}^{n}c\_i(1-s\_{2n+1-i}).
$$
I claim that $$-\sum\_{i=0}^n c\_is\_{2n+1-i}=s\_1=\sum\_{k\in \mathbb{Z}} (-1)^kq^{k(3k-1)/2}\quad\quad(\spadesuit)$$ (the last equality is Euler's Pentagonal theorem). Thus $S-s\_1=\sum\_{i=0}^n c\_i$, which is easy to see to be a polynomial in $q$ of degree $n(3n+1)/2$. On the other hand, $S$ is divisible by $q^{(n+1)(3n+2)/2}$ (that is seen from its very definition), thus this polynomial must be equal to $-s\_1 \pmod {q^{(n+1)(3n+2)/2}}=-\sum\_{|k|\leqslant n} (-1)^kq^{k(3k-1)/2}$, and we get your formula for $S$.


It remains to prove $(\spadesuit)$. Since $s\_{2n+1-i}(q^{n+1})\_{n-i}=s\_{n+1}$, $(\spadesuit)$ reads as
$$
s\_{n+1}\sum\_{i=0}^n (-1)^{i+1}{n\choose i}\_q q^{i(i+1)/2}=-s\_1,
$$
or, equivalently,
$$
\sum\_{i=0}^n (-1)^{i}{n\choose i}\_q q^{i(i+1)/2}=(q)\_{n},
$$
which is a partial case of the $q$-binomial theorem $(x)\_n=\sum\_{i=0}^n (-1)^{i}{n\choose i}\_q q^{i(i-1)/2}x^i$ for $x=q$.


