# Dynamics of discounted prices (multi-dimensional)

My objective is to find the dynamics of the discounted prices, given by $$\mathbf{y}_{t} = \mathbf{P}_{t}\mathrm{e}^{-\int^{t}_{0} r_{s} ds}$$. I know the dynamics should be $$d\mathbf{y}_{t} = \mathrm{diag}(\mathbf{y}_{t})[(\mu_{t} - r_{t}\mathbf{1})dt + \sigma_{t}d\mathbf{W}_{t}]$$, where $$\mu_{t}$$ is a vector, $$\mathbf{1}$$ is a vector of ones, and $$\sigma_{t}$$ is a matrix.

My approach is as follows. Define $$f(t,\mathbf{y}_{t},D_{t}) = \mathbf{P}_{t}D_{t}$$, where $$D_{t} = \mathrm{e}^{-\int^{t}_{0}r_{s}ds}$$. The dynamics of $$D_{t}$$ is: $$dD_{t} = -D_{t}r_{t}dt$$. Using Itô's Lemma, we get \begin{align*} d\mathbf{y_{t}} &= 0dt + D_{t}d\mathbf{P}_{t} + \mathbf{P}_{t}dD_{t} + \frac{1}{2} \cdot 0(d\mathbf{P}_{t})^{2} + \frac{1}{2} \cdot 0 (dD_{t})^{2} + \mathbf{1} (d\mathbf{P}_{t})(dD_{t})\\ &= D_{t}d\mathbf{P}_{t} + \mathbf{P}_{t}dD_{t} \end{align*}.

It is given that the dynamics of $$\mathbf{P}_{t}$$ is: $$d\mathbf{P}_{t} = \mathrm{diag}(\mathbf{P}_{t})[\mu_{t}dt + \sigma_{t}d\mathbf{W}_{t}]$$, again $$\mu_{t}$$ is a vector and $$\sigma_{t}$$ is a matrix. Inserting the $$\mathbf{P}_{t}$$ and $$D_{t}$$ dynamics we get

\begin{align*} d\mathbf{y}_{t} &= D_{t}d\mathbf{P}_{t} + \mathbf{P}_{t}dD_{t}\\ &= D_{t}\left[\mathrm{diag}(\mathbf{P}_{t})[\mu_{t}dt + \sigma_{t}d\mathbf{W}_{t}]\right] + \mathbf{P}_{t}\left[-D_{t}r_{t}dt\right]\\ &= D_{t}\mathrm{diag}(\mathbf{P}_{t})\mu_{t}dt - \mathbf{P}_{t}D_{t}r_{t}dt + \mathrm{diag}(\mathbf{P}_{t})D_{t}\sigma_{t}d\mathbf{W}_{t}\\ &= \mathrm{diag}(\mathbf{y}_{t})\mu_{t}dt - \mathbf{y}_{t}r_{t}dt + \mathrm{diag}(\mathbf{y}_{t})\sigma_{t}d\mathbf{W}_{t}. \end{align*} This is where I'm stuck and it is probably some linear algebra rule that I'm missing, when deriving the relevant derivatives. To get the right result I need $$\mathbf{y}_{t}r_{t}dt$$ to be $$\mathrm{diag}(\mathbf{y}_{t})r_{t}\mathbf{1}dt$$.

Any help would be appreciated.

The realisation we need to make is that $$\mathbf{P}_{t} = \mathrm{diag}(\mathbf{P}_{t})\mathbf{1}$$. Doing this, we get
\begin{align*} d\mathbf{y}_{t} &= D_{t}d\mathbf{P}_{t} + \mathbf{P}_{t}dD_{t}\\ &= D_{t}\left[\mathrm{diag}(\mathbf{P}_{t})[\mu_{t}dt + \sigma_{t}d\mathbf{W}_{t}]\right] + \mathbf{P}_{t}\left[-D_{t}r_{t}dt\right]\\ &= D_{t}\mathrm{diag}(\mathbf{P}_{t})\mu_{t}dt - \mathbf{P}_{t}D_{t}r_{t}dt + \mathrm{diag}(\mathbf{P}_{t})D_{t}\sigma_{t}d\mathbf{W}_{t}\\ &= D_{t}\mathrm{diag}(\mathbf{P}_{t})\mu_{t}dt - \mathrm{diag}(\mathbf{P}_{t})\mathbf{1}D_{t}r_{t}dt + \mathrm{diag}(\mathbf{P}_{t})D_{t}\sigma_{t}d\mathbf{W}_{t}\\ &= \mathrm{diag}(\mathbf{P}_{t}D_{t})\mu_{t}dt - \mathrm{diag}(\mathbf{P}_{t}D_{t})\mathbf{1}r_{t}dt + \mathrm{diag}(\mathbf{P}_{t}D_{t})\sigma_{t}d\mathbf{W}_{t}\\ &= \mathrm{diag}(\mathbf{y}_{t})\mu_{t}dt - \mathrm{diag}(\mathbf{y}_{t})r_{t}\mathbf{1}dt + \mathrm{diag}(\mathbf{y}_{t})\sigma_{t}d\mathbf{W}_{t}\\ &= \mathrm{diag}(\mathbf{y}_{t})[(\mu_{t} - r_{t}\mathbf{1})dt + \sigma_{t}d\mathbf{W}_{t}] \end{align*}