Ta có: \(\left\{{}\begin{matrix}\left(-1\right)^{2n}=1\\\left(-1\right)^{2n+1}=-1\end{matrix}\right.\) với mọi \(n\in N\)
\(\Rightarrow g\left(-1\right)=1+\left(-1\right)+\left(-1\right)^2+\left(-1\right)^3+...+\left(-1\right)^{2020}\)
\(g\left(-1\right)=1-1+1-1+...+1-1+1\)
\(g\left(-1\right)=0+0+0+...+0+1=1\)
Lại có:
\(g\left(2\right)=1+2+2^2+2^3+...+2^{2020}\)
\(\Rightarrow2.g\left(2\right)=2+2^2+2^3+...+2^{2020}+2^{2021}\)
\(\Rightarrow2.g\left(2\right)+1-2^{2021}=1+2+2^2+2^3+...+2^{2020}\)
\(\Rightarrow2.g\left(2\right)+1-2^{2021}=g\left(2\right)\)
\(\Rightarrow g\left(2\right)=2^{2021}-1\)