#set document(title: "3.3 Polynomial Fitting", author: "OpenStax / XYZ Homework") #set page(width: 8.5in, height: auto, margin: 1in) #import "@preview/cetz:0.5.2" #set text(font: ("STIX Two Text", "Libertinus Serif", "New Computer Modern"), size: 10.5pt, lang: "en") #show math.equation: set text(font: ("STIX Two Math", "New Computer Modern Math")) #set par(justify: true, leading: 0.62em, spacing: 0.9em) #set enum(spacing: 1.1em) // room between list items so tall inline fractions don't collide #set list(spacing: 1.1em) #set table(stroke: 0.5pt + rgb("#c7ccd3")) #let BLUE = rgb("#183B6F") // brand navy — section bars + example/solution labels (white on navy 11.09:1) #let ORANGE = rgb("#A94509") // brand primary-700 — AA-safe deep orange for TEXT (5.93:1 on white; raw brand #F37021 is 2.94:1 and must never carry text) #let RED = rgb("#DC2626") // brand error-600 #let GREEN = rgb("#059669") // brand success-600 (decoration only; small green text uses green-text #007942) #show heading.where(level: 1): it => block(width: 100%, above: 0pt, below: 16pt, fill: gradient.linear(BLUE, rgb("#2C5AA0")), inset: (x: 14pt, y: 12pt), radius: 3pt, text(fill: white, weight: "bold", size: 19pt, it.body)) #show heading.where(level: 2): it => block(width: 100%, above: 18pt, below: 10pt, fill: BLUE, inset: (x: 10pt, y: 6pt), radius: 2pt, text(fill: white, weight: "bold", size: 12pt, it.body)) #show heading.where(level: 3): it => text(fill: ORANGE, weight: "bold", size: 12.5pt, it.body) #show heading.where(level: 4): it => text(fill: BLUE, weight: "bold", size: 10.5pt, it.body) #let examplebox(label, title, body) = block(width: 100%, breakable: true, fill: rgb("#EFF1F5"), stroke: 0.5pt + rgb("#CFDDF0"), radius: 4pt, inset: 10pt, above: 12pt, below: 12pt)[ #block(below: 6pt)[#box(fill: BLUE, inset: (x: 6pt, y: 2pt), radius: 2pt, text(fill: white, weight: "bold", size: 8.5pt, label)) #h(0.4em) #strong[#title]] #body] // rail = decorative left rule (raw brand token); labelcolor = AA-safe label text shade #let notebox(label, rail, labelcolor, tint, body) = block(width: 100%, breakable: true, fill: tint, stroke: (left: 3pt + rail), inset: (left: 10pt, rest: 8pt), radius: (right: 4pt), above: 11pt, below: 11pt)[ #text(fill: labelcolor, weight: "bold", size: 7.5pt, tracking: 0.5pt)[#upper(label)] #linebreak() #body] #let solutionbox(body) = block(above: 4pt, below: 8pt)[ #text(fill: BLUE, weight: "bold", size: 8.5pt)[Solution] #linebreak() #body] #let figph(msg) = block(width: 100%, height: 60pt, fill: rgb("#f6f7f9"), stroke: (paint: rgb("#c7ccd3"), dash: "dashed"), radius: 4pt, inset: 10pt)[ #align(center + horizon, text(fill: rgb("#889"), style: "italic", size: 9pt, msg))] // Standardize inlined figure sizes: measure the natural CeTZ canvas, then scale to a // consistent envelope (aspect-aware; see build_typst.py FIG_* constants). Unlike the // print preamble, dimensions are FLOORED: in an editor a user can trim a figure to a // degenerate 1-D shape (a bare line), and w/h or tw/w would then divide by zero. #let _STD_W = 3.5 #let _WIDE_W = 5.6 #let _MAX_H = 3.4 #let _ASPECT_WIDE = 2.2 #let _UPSCALE_MAX = 1.15 #let stdfig(body) = context { let m = measure(body) let w = calc.max(m.width / 1in, 0.01) let h = calc.max(m.height / 1in, 0.01) let tw = if w / h > _ASPECT_WIDE { _WIDE_W } else { _STD_W } let s = calc.min(tw / w, _MAX_H / h, _UPSCALE_MAX) align(center, box(scale(x: s * 100%, y: s * 100%, reflow: true, body))) } #show figure: set block(breakable: false) #set figure(gap: 8pt) #show figure.caption: set text(size: 8.5pt, fill: rgb("#555")) == 3.3#h(0.6em)Polynomial Fitting #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ A standard #math.equation(block: false, alt: "8 times 8")[$8 × 8$] chessboard contains 64 squares. Actually, this is just the number of unit squares. How many squares of all sizes are there on a chessboard? Start with smaller boards: #math.equation(block: false, alt: "1 times 1")[$1 × 1$], #math.equation(block: false, alt: "2 times 2")[$2 × 2$], #math.equation(block: false, alt: "3 times 3")[$3 × 3$], etc. Find a formula for the total number of squares in an #math.equation(block: false, alt: "n times n")[$n × n$] board. ] So far we have seen methods for finding the closed formulas for arithmetic and geometric sequences. Since we know how to compute the sum of the first #math.equation(block: false, alt: "n")[$n$] terms of arithmetic and geometric sequences, we can compute the closed formulas for sequences which have an arithmetic (or geometric) sequence of differences between terms. But what if we consider a sequence which is the sum of the first #math.equation(block: false, alt: "n")[$n$] terms of a sequence which is itself the sum of an arithmetic sequence? Before we get too carried away, let's consider an example: How many squares (of all sizes) are there on a chessboard? A chessboard consists of #math.equation(block: false, alt: "64")[$64$] squares, but we also want to consider squares of longer side length. Even though we are only considering an #math.equation(block: false, alt: "8 times 8")[$8 × 8$] board, there is already a lot to count. So instead, let us build a sequence: the first term will be the number of squares on a #math.equation(block: false, alt: "1 times 1")[$1 × 1$] board, the second term will be the number of squares on a #math.equation(block: false, alt: "2 times 2")[$2 × 2$] board, and so on. After a little thought, we arrive at the sequence #math.equation(block: true, alt: "1 , 5 , 14 , 30 , 55 , and so on")[$1 , 5 , 14 , 30 , 55 , …$] . This sequence is not arithmetic (or geometric for that matter), but perhaps it's sequence of differences is. For differences we get #math.equation(block: true, alt: "4 , 9 , 16 , 25 , and so on")[$4 , 9 , 16 , 25 , …$] . Not a huge surprise: one way to count the number of squares in a #math.equation(block: false, alt: "4 times 4")[$4 × 4$] chessboard is to notice that there are #math.equation(block: false, alt: "16")[$16$] squares with side length 1, 9 with side length 2, 4 with side length 3 and 1 with side length 4. So the original sequence is just the sum of squares. Now this sequence of differences is not arithmetic since it's sequence of differences (the differences of the differences of the original sequence) is not constant. In fact, this sequence of #strong[second differences] is #math.equation(block: true, alt: "5 , 7 , 9 , and so on")[$5 , 7 , 9 , …$] , which #emph[is] an arithmetic sequence (with constant difference 2). Notice that our original sequence had #strong[third differences] (that is, differences of differences of differences of the original) constant. We will call such a sequence #math.equation(block: false, alt: "Δ cubed")[$upright(Δ)^(3)$]-constant. The sequence #math.equation(block: false, alt: "1 , 4 , 9 , 16 , and so on")[$1 , 4 , 9 , 16 , …$] has second differences constant, so it will be a #math.equation(block: false, alt: "Δ squared")[$upright(Δ)^(2)$]-constant sequence. In general, we will say a sequence is a #strong[#math.equation(block: false, alt: "Δ to the power k")[$upright(Δ)^(k)$]-constant] sequence if the #math.equation(block: false, alt: "k")[$k$]th differences are constant. #examplebox("Example 1")[][ Which of the following sequences are #math.equation(block: false, alt: "Δ to the power k")[$upright(Δ)^(k)$]-constant for some value of #math.equation(block: false, alt: "k")[$k$]? + #math.equation(block: false, alt: "2 , 3 , 7 , 14 , 24 , 37 , and so on")[$2 , 3 , 7 , 14 , 24 , 37 , …$]. + #math.equation(block: false, alt: "1 , 8 , 27 , 64 , 125 , 216 , and so on")[$1 , 8 , 27 , 64 , 125 , 216 , …$]. + #math.equation(block: false, alt: "1 , 2 , 4 , 8 , 16 , 32 , 64 , and so on")[$1 , 2 , 4 , 8 , 16 , 32 , 64 , …$]. #solutionbox[ + This is the sequence from Example, in which we found a closed formula by recognizing the sequence as the sequence of partial sums of an arithmetic sequence. Indeed, the sequence of first differences is #math.equation(block: false, alt: "1 , 4 , 7 , 10 , 13 , and so on")[$1 , 4 , 7 , 10 , 13 , …$], which itself has differences #math.equation(block: false, alt: "3 , 3 , 3 , 3 , and so on")[$3 , 3 , 3 , 3 , …$]. Thus #math.equation(block: false, alt: "2 , 3 , 7 , 14 , 24 , 37 , and so on")[$2 , 3 , 7 , 14 , 24 , 37 , …$] is a #math.equation(block: false, alt: "Δ squared")[$upright(Δ)^(2)$]-constant sequence. + These are the perfect cubes. The sequence of first differences is #math.equation(block: false, alt: "7 , 19 , 37 , 61 , 91 , and so on")[$7 , 19 , 37 , 61 , 91 , …$]; the sequence of second differences is #math.equation(block: false, alt: "12 , 18 , 24 , 30 , and so on")[$12 , 18 , 24 , 30 , …$]; the sequence of third differences is constant: #math.equation(block: false, alt: "6 , 6 , 6 , and so on")[$6 , 6 , 6 , …$]. Thus the perfect cubes are a #math.equation(block: false, alt: "Δ cubed")[$upright(Δ)^(3)$]-constant sequence. + If we take first differences we get #math.equation(block: false, alt: "1 , 2 , 4 , 8 , 16 , and so on")[$1 , 2 , 4 , 8 , 16 , …$]. Wait, what? That's the sequence we started with. So taking second differences will give us the same sequence again. No matter how many times we repeat this we will always have the same sequence, which in particular means no finite number of differences will be constant. Thus this sequence is not #math.equation(block: false, alt: "Δ to the power k")[$upright(Δ)^(k)$]-constant for any #math.equation(block: false, alt: "k")[$k$]. ] ] The #math.equation(block: false, alt: "Δ to the power 0")[$upright(Δ)^(0)$]-constant sequences are themselves constant, so a closed formula for them is easy to compute (it's just the constant). The #math.equation(block: false, alt: "Δ to the power 1")[$upright(Δ)^(1)$]-constant sequences are arithmetic and we have a method for finding closed formulas for them as well. Every #math.equation(block: false, alt: "Δ squared")[$upright(Δ)^(2)$]-constant sequence is the sum of an arithmetic sequence so we can find formulas for these as well. But notice that the format of the closed formula for a #math.equation(block: false, alt: "Δ squared")[$upright(Δ)^(2)$]-constant sequence is always quadratic. For example, the square numbers are #math.equation(block: false, alt: "Δ squared")[$upright(Δ)^(2)$]-constant with closed formula #math.equation(block: false, alt: "a sub n equals n squared")[$a_(n) = n^(2)$]. The triangular numbers (also #math.equation(block: false, alt: "Δ squared")[$upright(Δ)^(2)$]-constant) have closed formula #math.equation(block: false, alt: "a sub n equals the fraction n open parenthesis n plus 1 close parenthesis over 2")[$a_(n) = frac(n ( n + 1 ), 2)$], which when multiplied out gives you an #math.equation(block: false, alt: "n squared")[$n^(2)$] term as well. It appears that every time we increase the complexity of the sequence, that is, increase the number of differences before we get constants, we also increase the degree of the polynomial used for the closed formula. We go from constant to linear to quadratic. The sequence of differences between terms tells us something about the rate of growth of the sequence. If a sequence is growing at a constant rate, then the formula for the sequence will be linear. If the sequence is growing at a rate which itself is growing at a constant rate, then the formula is quadratic. You have seen this elsewhere: if a function has a constant second derivative (rate of change) then the function must be quadratic. This works in general: #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ #emph[Finite Differences] The closed formula for a sequence will be a degree #math.equation(block: false, alt: "k")[$k$] polynomial if and only if the sequence is #math.equation(block: false, alt: "Δ to the power k")[$upright(Δ)^(k)$]-constant (i.e., the #math.equation(block: false, alt: "k")[$k$]th sequence of differences is constant). ] This tells us that the sequence of numbers of squares on a chessboard, #math.equation(block: false, alt: "1 , 5 , 14 , 30 , 55 , and so on")[$1 , 5 , 14 , 30 , 55 , …$], which we saw to be #math.equation(block: false, alt: "Δ cubed")[$upright(Δ)^(3)$]-constant, will have a cubic (degree 3 polynomial) for its closed formula. Now once we know what format the closed formula for a sequence will take, it is much easier to actually find the closed formula. In the case that the closed formula is a degree #math.equation(block: false, alt: "k")[$k$] polynomial, we just need #math.equation(block: false, alt: "k plus 1")[$k + 1$] data points to “fit” the polynomial to the data. #examplebox("Example 2")[][ Find a formula for the sequence #math.equation(block: false, alt: "3 , 7 , 14 , 24 , and so on")[$3 , 7 , 14 , 24 , …$]. Assume #math.equation(block: false, alt: "a sub 1 equals 3")[$a_(1) = 3$]. #solutionbox[ First, check to see if the formula has constant differences at some level. The sequence of first differences is #math.equation(block: false, alt: "4 , 7 , 10 , and so on")[$4 , 7 , 10 , …$] which is arithmetic, so the sequence of second differences is constant. The sequence is #math.equation(block: false, alt: "Δ squared")[$upright(Δ)^(2)$]-constant, so the formula for #math.equation(block: false, alt: "a sub n")[$a_(n)$] will be a degree 2 polynomial. That is, we know that for some constants #math.equation(block: false, alt: "a")[$a$], #math.equation(block: false, alt: "b")[$b$], and #math.equation(block: false, alt: "c")[$c$], #math.equation(block: true, alt: "a sub n equals a n squared plus b n plus c")[$a_(n) = a n^(2) + b n + c$] . Now to find #math.equation(block: false, alt: "a")[$a$], #math.equation(block: false, alt: "b")[$b$], and #math.equation(block: false, alt: "c")[$c$]. First, it would be nice to know what #math.equation(block: false, alt: "a sub 0")[$a_(0)$] is, since plugging in #math.equation(block: false, alt: "n equals 0")[$n = 0$] simplifies the above formula greatly. In this case, #math.equation(block: false, alt: "a sub 0 equals 2")[$a_(0) = 2$] (work backwards from the sequence of constant differences). Thus #math.equation(block: true, alt: "a sub 0 equals 2 equals a times 0 squared plus b times 0 plus c")[$a_(0) = 2 = a ⋅ 0^(2) + b ⋅ 0 + c$] , so #math.equation(block: false, alt: "c equals 2")[$c = 2$]. Now plug in #math.equation(block: false, alt: "n equals 1")[$n = 1$] and #math.equation(block: false, alt: "n equals 2")[$n = 2$]. We get #math.equation(block: true, alt: "a sub 1 equals 3 equals a plus b plus 2")[$a_(1) = 3 = a + b + 2$] #math.equation(block: true, alt: "a sub 2 equals 7 equals a 4 plus b 2 plus 2")[$a_(2) = 7 = a 4 + b 2 + 2$] . At this point we have two (linear) equations and two unknowns, so we can solve the system for #math.equation(block: false, alt: "a")[$a$] and #math.equation(block: false, alt: "b")[$b$] (using substitution or elimination or even matrices). We find #math.equation(block: false, alt: "a equals the fraction 3 over 2")[$a = frac(3, 2)$] and #math.equation(block: false, alt: "b equals the fraction minus 1 over 2")[$b = frac(− 1, 2)$], so #math.equation(block: false, alt: "a sub n equals the fraction 3 over 2 n squared minus the fraction 1 over 2 n plus 2")[$a_(n) = frac(3, 2) n^(2) − frac(1, 2) n + 2$]. ] ] #examplebox("Example 3")[][ Find a closed formula for the number of squares on an #math.equation(block: false, alt: "n times n")[$n × n$] chessboard. #solutionbox[ We have seen that the sequence #math.equation(block: false, alt: "1 , 5 , 14 , 30 , 55 , and so on")[$1 , 5 , 14 , 30 , 55 , …$] is #math.equation(block: false, alt: "Δ cubed")[$upright(Δ)^(3)$]-constant, so we are looking for a degree 3 polynomial. That is, #math.equation(block: true, alt: "a sub n equals a n cubed plus b n squared plus c n plus d")[$a_(n) = a n^(3) + b n^(2) + c n + d$] . We can find #math.equation(block: false, alt: "d")[$d$] if we know what #math.equation(block: false, alt: "a sub 0")[$a_(0)$] is. Working backwards from the third differences, we find #math.equation(block: false, alt: "a sub 0 equals 0")[$a_(0) = 0$] (unsurprisingly, since there are no squares on a #math.equation(block: false, alt: "0 times 0")[$0 × 0$] chessboard). Thus #math.equation(block: false, alt: "d equals 0")[$d = 0$]. Now plug in #math.equation(block: false, alt: "n equals 1")[$n = 1$], #math.equation(block: false, alt: "n equals 2")[$n = 2$], and #math.equation(block: false, alt: "n equals 3")[$n = 3$]: #math.equation(block: true, alt: "1 equals, a plus b plus c; 5 equals, 8 a plus 4 b plus 2 c; 14 equals, 27 a plus 9 b plus 3 c")[$1 = & a + b + c \ 5 = & 8 a + 4 b + 2 c \ 14 = & 27 a + 9 b + 3 c$] . If we solve this system of equations we get #math.equation(block: false, alt: "a equals the fraction 1 over 3")[$a = frac(1, 3)$], #math.equation(block: false, alt: "b equals the fraction 1 over 2")[$b = frac(1, 2)$] and #math.equation(block: false, alt: "c equals the fraction 1 over 6")[$c = frac(1, 6)$]. Therefore the number of squares on an #math.equation(block: false, alt: "n times n")[$n × n$] chessboard is #math.equation(block: false, alt: "a sub n equals the fraction 1 over 3 n cubed plus the fraction 1 over 2 n squared plus the fraction 1 over 6 n equals the fraction 1 over 6 n open parenthesis n plus 1 close parenthesis open parenthesis 2 n plus 1 close parenthesis")[$a_(n) = frac(1, 3) n^(3) + frac(1, 2) n^(2) + frac(1, 6) n = frac(1, 6) n ( n + 1 ) ( 2 n + 1 )$]. ] ] Note: Since the squares-on-a-chessboard problem is really asking for the sum of squares, we now have a nice formula for #math.equation(block: false, alt: "∑ k equals 1 n k squared")[$display(limits(∑)^(n)_(k = 1) k^(2))$]. Not all sequences will have polynomials as their closed formula. We can use the theory of finite differences to identify these. #examplebox("Example 4")[][ Determine whether the following sequences can be described by a polynomial, and if so, of what degree. + #math.equation(block: false, alt: "1 , 2 , 4 , 8 , 16 , and so on")[$1 , 2 , 4 , 8 , 16 , …$] + #math.equation(block: false, alt: "0 , 7 , 50 , 183 , 484 , 1055 , and so on")[$0 , 7 , 50 , 183 , 484 , 1055 , …$] + #math.equation(block: false, alt: "1 , 1 , 2 , 3 , 5 , 8 , 13 , and so on")[$1 , 1 , 2 , 3 , 5 , 8 , 13 , …$] #solutionbox[ + As we saw in Example, this sequence is not #math.equation(block: false, alt: "Δ to the power k")[$upright(Δ)^(k)$]-constant for any #math.equation(block: false, alt: "k")[$k$]. Therefore the closed formula for the sequence is not a polynomial. In fact, we know the closed formula is #math.equation(block: false, alt: "a sub n equals 2 to the power n")[$a_(n) = 2^(n)$], which grows faster than any polynomial (so is not a polynomial). + The sequence of first differences is #math.equation(block: false, alt: "7 , 43 , 133 , 301 , 571 , and so on")[$7 , 43 , 133 , 301 , 571 , …$]. The second differences are: #math.equation(block: false, alt: "36 , 90 , 168 , 270 , and so on")[$36 , 90 , 168 , 270 , …$]. Third difference: #math.equation(block: false, alt: "54 , 78 , 102 , and so on")[$54 , 78 , 102 , …$]. Fourth differences: #math.equation(block: false, alt: "24 , 24 , and so on")[$24 , 24 , …$]. As far as we can tell, this sequence of differences is constant so the sequence is #math.equation(block: false, alt: "Δ to the power 4")[$upright(Δ)^(4)$]-constant and as such the closed formula is a degree 4 polynomial. + This is the Fibonacci sequence. The sequence of first differences is #math.equation(block: false, alt: "0 , 1 , 1 , 2 , 3 , 5 , 8 , and so on")[$0 , 1 , 1 , 2 , 3 , 5 , 8 , …$], the second differences are #math.equation(block: false, alt: "1 , 0 , 1 , 1 , 2 , 3 , 5 and so on")[$1 , 0 , 1 , 1 , 2 , 3 , 5 …$]. We notice that after the first few terms, we get the original sequence back. So there will never be constant differences, so the closed formula for the Fibonacci sequence is not a polynomial. ] ] Make up sequences that have + 3, 3, 3, 3, … as its second differences. + 1, 2, 3, 4, 5, … as its third differences. + 1, 2, 4, 8, 16, … as its 100th differences. Consider the sequence #math.equation(block: false, alt: "1 , 3 , 7 , 13 , 21 , and so on")[$1 , 3 , 7 , 13 , 21 , …$]. Explain how you know the closed formula for the sequence will be quadratic. Then “guess” the correct formula by comparing this sequence to the squares #math.equation(block: false, alt: "1 , 4 , 9 , 16 , and so on")[$1 , 4 , 9 , 16 , …$] (do not use polynomial fitting). #solutionbox[ #math.equation(block: true, alt: "a sub n equals n squared minus n plus 1")[$a_(n) = n^(2) − n + 1$]. ] Use a similar technique as in the previous exercise to find a closed formula for the sequence #math.equation(block: false, alt: "2 , 11 , 34 , 77 , 146 , 247 , and so on")[$2 , 11 , 34 , 77 , 146 , 247 , …$]. #solutionbox[ #math.equation(block: true, alt: "a sub n equals n cubed plus n squared minus n plus 1")[$a_(n) = n^(3) + n^(2) − n + 1$] ] Generalize Exercise: Find a closed formula for the sequence of differences of #math.equation(block: false, alt: "a sub n equals a n squared plus b n plus c")[$a_(n) = a n^(2) + b n + c$]. That is, prove that every quadratic sequence has arithmetic differences. #solutionbox[ #math.equation(block: false, alt: "a sub n minus 1 equals a open parenthesis n minus 1 close parenthesis squared plus b open parenthesis n minus 1 close parenthesis plus c equals a n squared minus 2 a n plus a plus b n minus b plus c")[$a_(n − 1) = a ( n − 1 )^(2) + b ( n − 1 ) + c = a n^(2) − 2 a n + a + b n − b + c$]. Therefore #math.equation(block: false, alt: "a sub n minus a sub n minus 1 equals 2 a n minus a plus b")[$a_(n) − a_(n − 1) = 2 a n − a + b$], which is arithmetic. Notice that this is not quite the derivative of #math.equation(block: false, alt: "a sub n")[$a_(n)$], which would be #math.equation(block: false, alt: "2 a n plus b")[$2 a n + b$], but it is close. ] Can you use polynomial fitting to find the formula for the #math.equation(block: false, alt: "n")[$n$]th term of the sequence 4, 7, 11, 18, 29, 47, …? Explain why or why not. #solutionbox[ No. The sequence of differences is the same as the original sequence so no differences will be constant. ] Will the #math.equation(block: false, alt: "n")[$n$]th sequence of differences of #math.equation(block: false, alt: "2 , 6 , 18 , 54 , 162 , and so on")[$2 , 6 , 18 , 54 , 162 , …$] ever be constant? Explain. #solutionbox[ No. The sequence is geometric, and in fact has closed formula #math.equation(block: false, alt: "2 times 3 to the power n")[$2 ⋅ 3^(n)$]. This is an exponential function, which is not equal to any polynomial of any degree. If the #math.equation(block: false, alt: "n")[$n$]th sequence of differences was constant, then the closed formula for the original sequence would be a degree #math.equation(block: false, alt: "n")[$n$] polynomial. ] In their down time, ghost pirates enjoy stacking cannonballs in triangular based pyramids (aka, tetrahedrons), like those pictured here: #figure(figph[A single shaded circle (meant to represent a cannonball)], alt: "A single shaded circle (meant to represent a cannonball)", caption: none) #figure(figph[Four overlapping circles, drawn to represent cannonballs stacked with a layer of three in a triangle with a single cannonball resting on top.], alt: "Four overlapping circles, drawn to represent cannonballs stacked with a layer of three in a triangle with a single cannonball resting on top.", caption: none) #figure(figph[Overlapping circles drawn to represent a three-dimensional tetrahedron of balls consisting of a triangle of 6 balls supporting a triangle of 3, with a single ball balanced on top.], alt: "Overlapping circles drawn to represent a three-dimensional tetrahedron of balls consisting of a triangle of 6 balls supporting a triangle of 3, with a single ball balanced on top.", caption: none) Note, these are solid tetrahedrons, so there will be some cannonballs obscured from view (the picture on the right has one cannonball in the back not shown in the picture, for example) The pirates wonder how many cannonballs would be required to build a pyramid 15 layers high (thus breaking the world cannonball stacking record). Can you help? + Let #math.equation(block: false, alt: "P open parenthesis n close parenthesis")[$P ( n )$] denote the number of cannonballs needed to create a pyramid #math.equation(block: false, alt: "n")[$n$] layers high. So #math.equation(block: false, alt: "P open parenthesis 1 close parenthesis equals 1")[$P ( 1 ) = 1$], #math.equation(block: false, alt: "P open parenthesis 2 close parenthesis equals 4")[$P ( 2 ) = 4$], and so on. Calculate #math.equation(block: false, alt: "P open parenthesis 3 close parenthesis")[$P ( 3 )$], #math.equation(block: false, alt: "P open parenthesis 4 close parenthesis")[$P ( 4 )$] and #math.equation(block: false, alt: "P open parenthesis 5 close parenthesis")[$P ( 5 )$]. + Use polynomial fitting to find a closed formula for #math.equation(block: false, alt: "P open parenthesis n close parenthesis")[$P ( n )$]. Show your work. + Answer the pirate's question: how many cannonballs do they need to make a pyramid 15 layers high? + Bonus: Locate this sequence in Pascal's triangle. Why does that make sense?