Matrix Manipulation/Algebra

A multi-product firm has total cost function C(q) = qtAq and faces inter-related but linear demand schedules for the n goods it produces: q = Bp + c. Both A and B are symmetric and B is invertible. Obtain an expression for total profit π(q) in the form π(q) = qtDq - etq where D and e are appropriate matrices.

2. Relevant equations

We are given that Total Cost is, C(q) = qtAq.
We also are given a production function: q = Bp + c

Total profits is just Total Revenue, p*q, minus Total Costs.
Hence:
π = p*q - C(q).
And we want to get it into a form like this:
π(q) = qtDq - etq

3. The attempt at a solution

So far I have done some manipulation of the production function:q = Bp+c
B-1(q-c)=p
and then substituted into the equation: π(q) = p*q-C(q) = (B-1(q-c))q - qtAq

The remaining dificulities I'm having is figuring out how to get this resulting equation to look something like the requested, π(q) = qtDq - etq. I'm also not sure if the algebra is fully legal.

While I know this isn't Physics, it's really just math. The only econ part of it is in the word problem and equation definitions. If you could help at all I would be most appreciative. If you need any more info please let me know.

Try thinking about this equation right here. Remember that both [itex]\mathbf{p}[/itex] and [itex]\mathbf{q}[/itex] are vectors, while [itex]n[/itex] is a scalar, so the "[itex]*[/itex]" is scalar multiplication. But scalar multiplication can be rewritten using matrix multiplication, right? And once you write it in that form, try looking at its transpose.

I've reworked this now, trying to pay a little more attention to the way the distributive property works with matrices as well as how transpose carries through. If I start from defining the profit, n.

n = TR - TC.
TR = pq
TC = C(q) = qtAq

We know that q = Bp+c which means that B-1(q-c) = p.
Now if I take the transpose of that, I get:
pt=(B-1(q-c))t=(q-c)t(B-1)t=(qt-ct)(B-1)t=(qt-ct)(Bt)-1=(qt-ct)B-1=qtB-1-ctB-1 since we knew B was symmetrical, and therefore B=Bt

Now when I substitute that back into the equation, I get:
ptq=(qtB-1-ctB-1)q=qtB-1q-ctB-1q

If I do the same with taking C(q)t, I get:
C(q)t = (qAqt)t=qtAtq=qtAq because A is symmetrical as well.

Now, putting that all into the equation we arrive at:
n = ptq-C(q)t
n = qtB-1q-ctB-1q-qtAq=qt(B-1-A)q-ctB-1q
and that falls into the n = qtDq - etq kind of format.

*I guess the issue is this: if I let n = pq - c = ptq-ct it works. Is this possible or do I have to start from the beginning and say nt = (pq)t-ct?