Calculus
posted by Q .
There are 50 apple trees in an orchard, and each tree produces an average of 200 apples each year. For each additional tree planted within the orchard, the average number of apples produced drops by 5. What is the optimal number of trees to plant in the orchard?
I mostly need help getting an equation and defining a variable

the number of apples is yield/tree * # trees.
With x trees, yield per tree is 200  5(x50) for x > 50
So, total crop is
c(x) = x(2005(x50)) = x(4505x) = 450x  5x^2
c'(x) = 45010x
c' = 0 at x=45
So, the max yield is achieved with 45 trees 
number apples=average*number trees
let x be the nubmer of trees 50<x<inf
number apples=(200(x50)*5)(x) where x is the number of trees, 50<x<infinity
N=200x5x^2 +250x
dN/dx=0=20010x+250
10x=450
x=45
but x>50, so look at optimal
check x=50 N=50*200=10000 apples
check x=51 N=(51)(195)=9945
so indeed, the optimal is 50. 
now if you are allowed to remove trees, and for each tree removed, the average goes up by 5, then the optimal is to remove five trees.

Dang  forgot the restriction on the domain.