# Find closed-form solution of this problem

Would Mathematica be able to solve for the closed-form solution to the following type of problem?

For $$i\in\{0,1,2,...\}$$ we have that$$C_{3*i+1}=C\\C_{3*i+2}=-C\\C_{3*i+3}=C$$Assume $$r\gt0$$. What is the closed form solution for$$\sum_{i=1}^\infty\dfrac{C_i}{(1+r)^i}?$$

 c*Sum[1/(1+r)^(3*i - 2) - 1/(1+r)^(3*i - 1) + 1/(1+r)^(3*i), {i, 1, Infinity}]
(* c (1 + r + r^2))/(r (3 + 3 r + r^2) *)

• First, the grouping 1/(1+r)^(3*i - 2) - 1/(1+r)^(3*i - 1) + 1/(1+r)^(3*i) is made by hand, not with MMA. Second, that grouping should be grounded (see a related thread). In the case under consideration the series is absolutely convergent. Commented Dec 15, 2023 at 15:10

This can be done as follows. First, we find an explicit formula for the coefficients by (c is used instead of C because capital letters are often reserved in WL.)

FindSequenceFunction[{c, -c, c, c, -c, c, c, -c, c}, i]


1/3 c (1 + E^(2/3 I (-3 + i) \[Pi]) + E^(4/3 I (-3 + i) \[Pi])) - 1/3 c (1 + E^(2/3 I (-2 + i) \[Pi]) + E^(4/3 I (-2 + i) \[Pi])) + 1/3 c (1 + E^(2/3 I (-1 + i) \[Pi]) + E^(4/3 I (-1 + i) \[Pi]))

Second, we find the sum of the series by

Sum[(1/3 c (1 + E^(2/3 I (-3 + i) \[Pi]) + E^(
4/3 I (-3 + i) \[Pi])) -
1/3 c (1 + E^(2/3 I (-2 + i) \[Pi]) + E^(
4/3 I (-2 + i) \[Pi])) +
1/3 c (1 + E^(2/3 I (-1 + i) \[Pi]) + E^(
4/3 I (-1 + i) \[Pi])))/(1 + r)^i, {i, 1, Infinity},
Assumptions -> r > 0] // FullSimplify


(c (1 + r + r^2))/(r (3 + r (3 + r)))

Sum[Piecewise[{{c, Mod[i, 3] == 1}, {-c, Mod[i, 3] == 2},

(c (1 + r + r^2))/(r (3 + 3 r + r^2))
Using Switch:
Sum[Switch[Mod[i, 3], 0 | 1, c, 2, -c]/(1 + r)^i, {i, 1, Infinity}]
(c (1 + r + r^2))/(r (3 + 3r + r^2))