With little bit of observation and practice with generating functions, one can solve it faster,
(This is one way to solve it, if have you practiced enough, i would suggest to first practice with lot of problems, then only you can see how fast the below method gets you the answer)
Observations:
given closed form $2n +3$ can be seen as combination of two closed form,
a linear and a constant ( 2, 3 are just shifting)
Recall:
closed form |
f(n) |
$\frac{1}{\left ( 1-x \right )}$ |
$1$ |
$\frac{1}{\left ( 1-x \right )^{2}}$ |
$n + 1$ |
with some practice you will get used to them..
(I’m not telling you to remember these forms, when you do practice these are some basic forms which gets stick to your mind by itself.)
$a_n = 2n + 3 = 2(n+1) + 1$
closed form for the generating function will be:
$2 \times \frac{1}{\left ( 1-x \right )^{2}} + \frac{1}{\left ( 1-x \right )}$$= \frac{2 + \left (1-x \right )}{\left ( 1-x \right )^{2}} = \frac{3-x}{\left ( 1-x \right )^{2}}$