# Explicit form of recursive function representing marginal cost

I am selling a printing service and I would like to charge marginally less for an additional print compared with the average cost of each print given the current quantity. My recursive rule representing the total charge for X+1 given X is therefore:

$$f(x+1) = \left(\frac{f(x)}{x}\times d\right) + f(x)$$ $$f(0) = 0; f(1) = C$$ $${d \; \epsilon \; \mathbb{R}\; | \;0

My WooCommerce site won't let me use a recursive rule so I was wondering if there is an explicit approximation of this?

Thanks!

No need for an approximation. Note that our recursion can be restated as $$f(x+1)=\left(\frac{d}x+1\right)f(x)$$ Hence, by applying this formula $$x$$ times, we have that (for $$x\ge0$$) \begin{align} f(x+1) &=C\cdot\prod_{k=1}^x\left(\frac{d}k+1\right)\\ &=C\cdot\prod_{k=1}^x\left(\frac{d+k}k\right)\\ &=C\cdot\frac{(d+x)(d+x-1)\cdots(d+1)}{x!}\\ &=C\binom{d+x}{x}\\ \end{align} Hence we have the closed form $$f(x)=\begin{cases}C\binom{d+x-1}{x-1}&x\ge1\\0&x=0\end{cases}$$
• Nicely done. I will note that, If one takes $\binom{n}{m}=0$ for integer $m<0$, then the $x=0$ case at the end is superfluous. But that's a matter of conventions, so your pointing it out explicitly is still sensible. Commented Aug 19, 2019 at 17:38