I am reading through a piece of work and the author does the following:
Starting with \begin{equation} C = f(K, \sigma(K)), \end{equation} then, taking derivatives w.r.t $K$, \begin{equation} \frac{\partial C}{\partial K} = \frac{\partial f}{\partial K} + \frac{\partial f}{\partial \sigma}\frac{\partial \sigma}{\partial K}. \end{equation}
However, this doesn't make sense to me. I am familiar with a total derivative, but it that case wouldn't it be correct to say: \begin{equation} \frac{d C}{d K} = \frac{\partial f}{\partial K} + \frac{\partial f}{\partial \sigma}\frac{d \sigma}{d K}. \end{equation} I thought the whole idea of partial derivatives was that you treat other parameters as constants, so
\begin{equation} \frac{\partial C}{\partial K} = \frac{\partial f}{\partial K}. \end{equation} Am I missing something obvious?
Furthermore, how can I extend this idea to the second derivative, if I want to obatain $\frac{\partial^2 C}{\partial K^2}$. For example, I know that \begin{equation} \frac{d^2C}{dK^2} = \frac{\partial^2 f}{\partial K^2}+2\frac{\partial^2 f}{\partial K \partial \sigma} \frac{d\sigma}{dK} + \frac{\partial^2 f}{\partial \sigma^2} \frac{d\sigma^2}{dK^2}. \end{equation} Can I simply replace the $d$ operator with the partial operator, like the author has done in the first example?
You're right, it is weird to write $\dfrac{\partial C}{\partial K}$ especially when $C: \Bbb{R} \to \Bbb{R}$ is a function of $1$ variable only. If it were me, I would write it as \begin{align} \dfrac{dC}{dK} &= \dfrac{\partial f}{\partial K} + \dfrac{\partial f}{\partial \sigma}\dfrac{d\sigma}{dK} \end{align} or to be slightly more precise and indicate where everything is being evaluated, \begin{align} \dfrac{dC}{dK}\bigg|_K &= \dfrac{\partial f}{\partial K}\bigg|_{(K,\sigma(K))} + \dfrac{\partial f}{\partial \sigma}\bigg|_{(K,\sigma(K))}\cdot\dfrac{d\sigma}{dK}\bigg|_K \tag{$\ddot{\smile}$} \end{align} where the $\bigg|_K$ means we're calculating the derivative at the point $K\in \Bbb{R}$, and $\bigg|_{(K,\sigma(K))}$ means we're evaluating the partial derivative at the point $(K,\sigma(K)) \in \Bbb{R}^2$.
It seems like you have the right concepts regarding the distinction between total and partial derivatives, but you're getting confused by what I'd say is the author's sloppiness with notation. You should never confuse $\partial$ with $d$. You ask
Well actually this is incorrect, and you can even see this quite easily. Because on the LHS, $C:\Bbb{R} \to \Bbb{R}$, $K\mapsto C(K)$ is a function of one variable only, so writing $\dfrac{\partial C}{\partial K}$ really means $\dfrac{dC}{dK}$ (because there's nothing else to keep constant, so a partial derivative of $C$ is actually just its total derivative... also it is very weird to use partial derivative notation for functions of one variable). But, the correct formula is given by the chain rule as in $(\ddot{\smile})$, so $(\ddot{\frown})$ is false.
For your final question again, forget about $\dfrac{\partial^2C}{\partial K^2}$, it should be more commonly written as $\dfrac{d^2C}{dK^2}$; however, your expression for it seems incorrect and you're missing an extra term (probably you forgot to use product rule). It should be (assuming $f$ is a $C^2$ function so that the order of partial derivatives doesn't matter (this is how you get the factor of $2$)) \begin{align} \dfrac{d^2C}{dK^2} &= \dfrac{\partial^2 f}{\partial K^2} + 2\dfrac{\partial^2 f}{\partial K \partial \sigma} \dfrac{d\sigma}{dK} +\dfrac{\partial^2 f}{\partial \sigma^2} \left(\dfrac{d\sigma}{dK}\right)^2 + \dfrac{\partial f}{\partial \sigma} \dfrac{d^2\sigma}{dK^2} \end{align} or once again, being slightly more precise with where all the derivatives are evaluated: \begin{align} \dfrac{d^2C}{dK^2}\bigg|_K &= \dfrac{\partial^2 f}{\partial K^2}\bigg|_{(K,\sigma(K))} + 2\dfrac{\partial^2 f}{\partial K \partial \sigma}\bigg|_{(K,\sigma(K))}\cdot \dfrac{d\sigma}{dK}\bigg|_K \\ &+\dfrac{\partial^2 f}{\partial \sigma^2}\bigg|_{(K,\sigma(K))} \cdot\left(\dfrac{d\sigma}{dK}\bigg|_K\right)^2 + \dfrac{\partial f}{\partial \sigma}\bigg|_{(K,\sigma(K))} \cdot \dfrac{d^2\sigma}{dK^2}\bigg|_K \end{align}
Now if on the other hand $\sigma$ was a function which depended on more variables, say $\sigma: \Bbb{R}^2 \to \Bbb{R}$, and we have (please excuse my change of notation) \begin{align} C(\xi,\eta) &= f(\xi,\sigma(\xi,\eta)) \end{align} then, we can meaningfully talk about partial derivatives of $C$, and they are given as: \begin{align} \begin{cases} \dfrac{\partial C}{\partial \xi} &= \dfrac{\partial f}{\partial \xi}\cdot \dfrac{\partial \xi}{\partial \xi} + \dfrac{\partial f}{\partial \sigma}\cdot \dfrac{\partial \sigma}{\partial \xi} = \dfrac{\partial f}{\partial \xi} + \dfrac{\partial f}{\partial \sigma}\cdot \dfrac{\partial \sigma}{\partial \xi} \\\\ \dfrac{\partial C}{\partial \eta} &= \dfrac{\partial f}{\partial \xi}\cdot \dfrac{\partial \xi}{\partial \eta} + \dfrac{\partial f}{\partial \sigma}\cdot \dfrac{\partial \sigma}{\partial \eta} = 0 + \dfrac{\partial f}{\partial \sigma}\cdot \dfrac{\partial \sigma}{\partial \eta} \end{cases} \end{align} As for the point of evaluation, after the partial derivative of $f$, it should be $\bigg|_{(\xi,\sigma(\xi,\eta))}$, while after the partial derivatives of $C$ and $\sigma$ it should be $\bigg|_{(\xi,\eta)}.$