0

How is the following multiplication performed for this (cost) function:

$J=\frac{1}{2}\int_0^T{[y(t)-\hat{\pmb{x}}^T\pmb{h}(t)]^T[y(t)-\hat{\pmb{x}}^T\pmb{h}(t)]dt}$$=\frac{1}{2}\int_0^T{[y(t)]^2dt}-[\int_0^T{[y(t)\pmb{h}^T(t)dt}]\hat{\pmb{x}}+\frac{1}{2}\hat{\pmb{x}}^T[\int_0^T{[\pmb{h}(t)\pmb{h}^T(t)dt}]\hat{\pmb{x}}$

I can't see how we get the second term. Also, the third term implies that, only for this case, AB=BA, where A and B are matrices, right?

EDIT: $\pmb{h}(t)$ is a column vector of functions of $t$ and $\pmb{\hat{x}}$ is a column vector of numbers.

student1
  • 176
  • 1
  • 9
  • 3
    The term $x^T h$ is a scalar. You have $x^T h = h^T x$, and $h^T x x^T h = x^T h h^T x$. The only $AB=BA$ sort of thing is for scalars... – copper.hat Sep 23 '14 at 16:10
  • I added a comment. I think this clarifies the question. Your answer is right only if we evaluated that product at a single instant of time $t$, am not sure if this is the case here. – student1 Sep 23 '14 at 16:34
  • Your first integral perplexes me: $y(t)-\hat{\pmb{x}}^T \pmb{h}(t)$ is a scalar, so why are you taking a transpose? – Semiclassical Sep 23 '14 at 17:08
  • The standard form of the cost function in Least Squares is $J=ee^T=[y^~-H\hat{x}]^T[y^~-H\hat{x}]$ where $H$ is a matrix of the basis functions, $y^~$ is the measurements vector and $\hat{x}$ is the estimated values vector. – student1 Sep 23 '14 at 17:15
  • 1
    At any instant $t$, the equation $(x^T h(t))^T x^T h(t) = x^T h(t)h(t)^T x$ holds, so my answer is right for any time. I am certain of this. You are confusing yourself by treating scalars as matrices. – copper.hat Sep 23 '14 at 17:28
  • 1
    @student1: That's fine, but that's not the definition you've used in your problem: You have $h$ as a column vector, so $h^T x$ remains a scalar and not a vector. – Semiclassical Sep 23 '14 at 21:49
  • Thanks. I don't see any answers here to mark, I think @copper.hat was the first to answer in a comment. – student1 Sep 24 '14 at 01:18
  • There, I turned my comment into an answer! – copper.hat Sep 24 '14 at 01:52

1 Answers1

2

Since $x^T h(t)$ is a scalar for all $t$, we have $(x^T h(t))^T x^T h(t) = x^T h(t)h(t)^T x $. The latter can be written as $x^T \left[ h(t)h(t)^T \right] x$ using associativity.

copper.hat
  • 172,524