Assuming that "x" equals the number of times the retailers increase the price by $0.50, I created the following functions:
cost... c(x) = 6(200 - 7x)
revenue... r(x) = (200 - 7x)(10 + 0.5x)
profit ... p(x) = r(x) - c(x) = (200 - 7x)(10 + 0.5x) - 6(200 - 7x) = -3.5x^2 + 72x + 800
derivative of profit function... p'(x) = -7x + 72
I then let p'(x) = 0, which allowed me to isolate x, which equals 10.28. I then plugged 10.28 into the price function (which is within the revenue function): 10 + 0.5(10.28) = 15 dollars.
I am somewhat bemused by the thought that prices can only be increased in 50 cent increments. Prices can actually be raised in increments of a penny. Cakes, however, are sold in integers so let's stick with the 50 cents.
x = number of price increments of 50 cents
r(x) = revenue.
c(x) = cost.
p(x) = profit r(x) - c(x).
$r(x) = (200 - 7x)(10 + 0.5x) = 2000 + 30x - 3.5x^2.$
$c(x) = (200 - 7x) * 6 = 1200 - 42x.$
$\therefore p(x) = 2000 + 30x - 3.5x^2 - (1200 - 42x) = 800 + 72x - 3.5x^2 \implies$
$p'(x) = 72 - 7x \implies p'(x) = 0 \iff 7x = 72 \implies x \approx 10.29.$
So you were doing fine to here, but there is one more step to go.
But we are saying that x must be an integer so optimization may occur at x = 10 or x = 11. We must test. You cannot assume rounding will work because the function is not linear.
$p(10) = 2000 + 72(10) - 3.5(10)^2 = 2000 + 300 - 350 = 2370.$
$p(11) = 2000 + 72(11) - 3.5(11)^2 = 2000 + 330 - 423.50 = 2368.50.$
So the profit maximizing price is $10 + 10 * 0.5 = 15.$
The number of cakes sold is $200 - 7 * 10 = 130.$
Well done (except for just assuming that rounding will work in a non-linear case).
Now for part b. There are a few ways we could attack this, but let's try the most straightforward.
If you want to keep the cost price of 6, you must sell at least 165. That is called a constraint or a boundary condition. Now what does that mean in terms of x?
$200 - 7x \ge 165 \implies 35 \ge 7x \implies 5 \ge x \implies x \le 5.$
Let's look at p'(x) again.
$p'(x) = 72 - 7x \text { and } x \text { is an integer} \implies p'(x) > 0 \iff x \le 10.$
Every increase in x increases profit so long as x stays under 11, but in this case x must stay under 6. Therefore the profit maximizing number of increments is 5 and so the profit maximizing price is 10 + 0.5x = 12.50 if the cost price stays at 6. In that case,
$p(5) = 2000 +72(5) - 3.5(5^2) = 2272.5.$
So one option is to maintain the cost price of 6 and raise the sales price to 12.50.
But there is another option. And that is to accept a cost price of 7.5 and raise sales price even more.
In that case, revenue will stay the same but we will have a new cost function and so a new profit function.
$r(x) = 2000 + 30x - 3.5x^2.$
d(x) = new cost function, and q(x) = new profit function = r(x) - d(x).
$d(x) = (200 - 7x) * 7.5 = 1500 - 52.5x \implies$
$q(x) = 500 + 82.5x - 3.5x^2 \implies q'(x) = 82.5 - 7x \implies q'(x) = 0 \iff x = 11.78.$
Thus x = 11 or x = 12.
$q(11) = 500 + 82.5(11) - 3.5(11^2) = 984.$
$q(12) = 500 + 82.5(12) - 3.5(12^2) = 986.$
It is better to accept a lower sales price of 12.5 and sell 165 cakes costing 6 a each than to set a higher sales price and sell fewer cakes costing 7.5 each.