We will first write cost function. As we are given three points here so we will use them to write quadratic function
----------------------------------------(1)
So we will plug point (2,30) in it first ( for 2 widgets cost is 30)
So simply plug 30 in y place and 2 in x place in equation (1) as shown

----------------------------------------------(2)
Similarly plug next point (4,118) now in equation (1)

----------------------------------------------(3)
Similarly plug third point (10,766) now in equation (1)

----------------------------------------------(4)
Now we have to solve system of linear equations (2),(3) and (4) for a,b,c
We can use method of elimination
Subtract equation (3) - equation (2)
118 = 16a +4b +c
-(30 = 4a +2b +c)
----------------------------------------------------
88 = 12a +2b -----------------------------------(5)
Similarly subtract equation (4)-equation (3)
766 =100a +10b +c
-( 118 = 16a +4b +c)
--------------------------------------
648 = 84a + 6b ------------------------(6)
Now to eliminate b in equations (5) and (6) multiply equation (5) by -3 and then add to equation (6)
-3×(88 = 12a +2b)
-264 = -36a - 6b
648 = 84a + 6b
---------------------------------
384 = 48a
Now solve for a

8 = a
Plug 8 in a place in equation (5) or (6) and solve for b as shown
88 = 12(8) +2b
88 = 96 + 2b
88 -96 = 96 +2b -96
-8 = 2b

-4 = b
now plug 8 in a place, -4 in b place in either of equations (2),(3) or (4) and solve for c
30 = 4(8) +2(-4) +c
30 = 32 -8 + c
30 = 24 + c
30 - 24 = 24 + c - 24
6 = c
So plugging values of a as 8, b as -4 and c as 6 in equation (1) we get

So thats the cost function. So now for 6 widgets, plug 6 in x place in this equation and find y value

y = 8(36) - 24 +6
y = 288 -24 +6
y = 270
So $270 is the cost for producing 6 widgets and thats the final answer