# Understanding the HJM drift condition's dimensions

In an HJM model the forward rate dynamics follow $$df_t(T) =a_t(f_t(T))dt+b_t(f_t(T))dW_t$$ where $W_t$ is a $d$-dimensional brownian motion, $b_t$ takes values in $\mathbb{R}^{d\times d}$ and $a_t$ takes values in $\mathbb{R}^d$.

My confusion arises when we speak of the no-arbitrage condition $$a_t = b_t\int_0^t b_s^T ds,$$ shouldn't the right hand side be $d\times d$ dimensional and the left hand side be $d$ dimensional?

Without loss of generality, we assume $d=1$. Set $$\gamma (t,f(t,T))=\int_{t}^{T}b(t,f(t,u))\,du$$ Indeed, we want to show $$a(t,f(t,T))=b(t,f(t,T))\gamma(t,f(t,T))$$ By application of definition, we have $$f(t,T)=-\frac{\partial \ln p(t,T)}{\partial T}$$ therefore $$\ln p(t,T)=-\int_{t}^{T}{f(t,u)\,du}$$ hence $$d\ln p(t,T)=r(t)dt-\int_{t}^{T}{df(t,u)\,du}$$ in other words $$d\ln p(t,T)=\left(r(t)-\int_{t}^{T}{a(t,u)\,du}\right)dt+\gamma (t,T)\,d{{W}}(t)$$ By application of Ito's lemma, we have $$d\left( \frac{p(t,T)}{B(t)} \right)=\frac{p(t,T)}{B(t)}\left(d\ln p(t,T)+\frac{1}{2}d[\ln p(t,T),\ln p(t,T)](t)-r(t)dt\right)$$ thus $$d\left( \frac{p(t,T)}{B(t)} \right)=\frac{p(t,T)}{B(t)}\left( -\left[ \int_{t}^{T}{a (t,u)\,du} \right]dt+\frac{1}{2}{{\gamma }^{2}}(t,T)dt-\gamma (t,T)d{{W}}(t) \right)$$ we know ${p(t,T)}/{B(t)}$ is a martingale, so $$-\left(\int_{t}^{T}{a (t,u)\,du} \right)+\frac{1}{2}{{\gamma }^{2}}(t,T)=0$$ i.e. $$\int_{t}^{T}{a (t,u)\,du}=\frac{1}{2}{{\gamma }^{2}}(t,T)$$ therefore $$\frac{d}{dT}\left(\int_{t}^{T}{a (t,u)\,du}\right)=\frac{1}{2}\frac{d}{dT}{{\gamma }^{2}}(t,T)$$ finally $$a(t,f(t,T))=b(t,f(t,T))\gamma(t,f(t,T))=b(t,f(t,T))\int_{t}^{T}b(t,f(t,u))\,du$$
Your issue is that you misinterpreted the NA criterion, it reads: $$a_t(x) \triangleq \sum_{i=1}^{\infty} \left(b^i_t(x) \int_0^x (b_t^i(u))^T du\right)e_i,$$ where $b^i_t$ denotes the $i^{th}$ column of the volatility matrix $b_t$, $^T$ the transpose and $e_i$ the $i^{th}$ standard basis vector in $\ell^1$. In other words the $i^th$ coordinate of the vector $a_t(x)$ is given by: $$a_t^i(x)\triangleq b_t^i(x)\int_0^x b_t^i(u)^T du.$$
Of course if you want a $d$-dimensional process simply take $\mathbb{R}^d$ instead of $\ell^1$ and assume the sum to go to $d$ instead of being infinite.
Note that, for a given maturity $T$, there is only one forward rate process $\{f_t(T), 0 \le t \le T\}$. That is, $f_t(T)$ is one-dimensional. Therefore, $b_t(f_t(T))$ can only be a $d$-dimensional vector, where $d\ge 1$; it can not be a $d\times d$ matrix，if $d>1$. Moreover, $a_t(f_t(T))$ is a scalar function, that is, it is not a vector. See the book Martingale Method for Financial Modeling or the book Interest Rate Models - Theory and Practice for more details.