How can I calculate $\sum_{k=1}^n (3k-1)^{2}$? I was trying to calculate the sum
$$\sum_{k=1}^n (3k-1)^2,$$
but actually I cannot frame the type. In fact is neither a geometric series, because the terms are not raised to the $k$th power, nor harmonic.
Any suggestions?
 A: If you know how to compute the sums
$$S_2(n):=\sum_{k=1}^nk^2,\mbox{ and } \quad S_1(n):=\sum_{k=1}^nk,$$
then the problem becomes: compute $9S_2(n)-6S_1(n)+n$.
A: Since $$(3k-1)^2=9k^2-6k+1=9k(k-1)+3k+1$$ and notice that $$\begin{align}\sum_{k=1}^{n}k(k-1)&=\sum_{k=1}^{n}\frac{(k+1)k(k-1)-k(k-1)(k-2)}{3}\\&=\frac{(n+1)n(n-1)}{3}\end{align}$$
and it's easy to verify $$\sum_{k=1}^{n}k=\frac{n(n+1)}{2}$$hence we have $$\begin{align}\sum_{k=1}^{n}(3k-1)^2&=3(n+1)n(n-1)+\frac{3}{2}n(n+1)+n\\&=3(n+1)n(n-\frac{1}{2})+n\end{align}$$
A: Let $\displaystyle  f(k)=Ak^3+Bk^2+Ck+D$ where $A,B,C,D$ are arbitrary constants
$\displaystyle\implies f(k+1)-f(k)=A\{(k+1)^3-k^3\}+B\{(k+1)^2-k^2\}+C\{(k+1)-k\}$$\displaystyle=A(3k^2+3k+1)+B(2k+1)+C$
$\displaystyle\implies f(k+1)-f(k)=3Ak^2+k(3A+2B)+A+B+C$
Comparing with $\displaystyle(3k-1)^2=9k^2-6k+1,$
$\displaystyle 3A=9\implies A=3,3A+2B=-6\implies B=-\frac{15}2;A+B+C=1\implies C=\frac{11}2 $
So, we can write $\displaystyle9k^2-6k+1=f(k+1)-f(k)$ which is a Telescoping series
$\displaystyle\implies\sum_{1\le k\le n}(3k-1)^2=f(n+1)-f(1)$
$\displaystyle=A(n+1)^3+B(n+1)^2+C(n+1)+D-(A+B+C+D) $
$\displaystyle=A\{(n+1)^3-1\}+B\{(n+1)^2-1\}+Cn$
Put the values of $A,B,C$ and optionally simplify
