We’ve learned that sequences are functions whose domain is over the positive integers. This is true for other types of functions, including some **piecewise functions**. Recall that a piecewise function is a function defined by multiple subsections. A different formula might represent each individual subsection.

### How To: Given an explicit formula for a piecewise function, write the first [latex]n[/latex] terms of a sequence

- Identify the formula to which [latex]n=1[/latex] applies.
- To find the first term, [latex]{a}_{1}[/latex], use [latex]n=1[/latex] in the appropriate formula.
- Identify the formula to which [latex]n=2[/latex] applies.
- To find the second term, [latex]{a}_{2}[/latex], use [latex]n=2[/latex] in the appropriate formula.
- Continue in the same manner until you have identified all [latex]n[/latex] terms.

### Example 3: Writing the Terms of a Sequence Defined by a Piecewise Explicit Formula

Write the first six terms of the sequence.

### Solution

Substitute [latex]n=1,n=2[/latex], and so on in the appropriate formula. Use [latex]{n}^{2}[/latex] when [latex]n[/latex] is not a multiple of 3. Use [latex]\frac{n}{3}[/latex] when [latex]n[/latex] is a multiple of 3.

The first six terms are [latex]\left\{1,\text{ }4,\text{ }1,\text{ }16,\text{ }25,\text{ }2\right\}[/latex].

### Analysis of the Solution

Every third point on the graph shown in Figure 5 stands out from the two nearby points. This occurs because the sequence was defined by a piecewise function.

### Try It 3

Write the first six terms of the sequence.

[latex]{a_{n}}=\begin{cases}2n^{3} \hfill& \text{if }n\text{ is odd} \\ \frac{5n}{2} \hfill& \text{if }n\text{ is even}\end{cases}[/latex]

## Finding an Explicit Formula

Thus far, we have been given the explicit formula and asked to find a number of terms of the sequence. Sometimes, the explicit formula for the [latex]n\text{th}[/latex] term of a sequence is not given. Instead, we are given several terms from the sequence. When this happens, we can work in reverse to find an explicit formula from the first few terms of a sequence. The key to finding an explicit formula is to look for a pattern in the terms. Keep in mind that the pattern may involve alternating terms, formulas for numerators, formulas for denominators, exponents, or bases.

### How To: Given the first few terms of a sequence, find an explicit formula for the sequence.

- Look for a pattern among the terms.
- If the terms are fractions, look for a separate pattern among the numerators and denominators.
- Look for a pattern among the signs of the terms.
- Write a formula for [latex]{a}_{n}[/latex] in terms of [latex]n[/latex]. Test your formula for [latex]n=1,\text{ }n=2[/latex], and [latex]n=3[/latex].

### Example 4: Writing an Explicit Formula for the *n*th Term of a Sequence

Write an explicit formula for the [latex]n\text{th}[/latex] term of each sequence.

- [latex]\left\{-\frac{2}{11},\frac{3}{13},-\frac{4}{15},\frac{5}{17},-\frac{6}{19},\dots \right\}[/latex]
- [latex]\left\{-\frac{2}{25}\text{,}-\frac{2}{125}\text{,}-\frac{2}{625}\text{,}-\frac{2}{3\text{,}125}\text{,}-\frac{2}{15\text{,}625}\text{,}\dots \right\}[/latex]
- [latex]\left\{{e}^{4}\text{,}{e}^{5}\text{,}{e}^{6}\text{,}{e}^{7}\text{,}{e}^{8}\text{,}\dots \right\}[/latex]

### Solution

Look for the pattern in each sequence.

- The terms alternate between positive and negative. We can use [latex]{\left(-1\right)}^{n}[/latex] to make the terms alternate. The numerator can be represented by [latex]n+1[/latex]. The denominator can be represented by [latex]2n+9[/latex].
[latex]{a}_{n}=\frac{{\left(-1\right)}^{n}\left(n+1\right)}{2n+9}[/latex]

- The terms are all negative.
So we know that the fraction is negative, the numerator is 2, and the denominator can be represented by [latex]{5}^{n+1}[/latex].

[latex]{a}_{n}=-\frac{2}{{5}^{n+1}}[/latex] - The terms are powers of [latex]e[/latex]. For [latex]n=1[/latex], the first term is [latex]{e}^{4}[/latex] so the exponent must be [latex]n+3[/latex].
[latex]{a}_{n}={e}^{n+3}[/latex]

### Try It 4

Write an explicit formula for the [latex]n\text{th}[/latex] term of the sequence.

[latex]\{9;−81,729;−6,561;59,049\}[/latex]

### Try It 5

Write an explicit formula for the [latex]n\text{th}[/latex] term of the sequence.

### Try It 6

Write an explicit formula for the [latex]n\text{th}[/latex] term of the sequence.