1

Let the vector $\ell = \begin{pmatrix} \ell_1 \\ \ell_2 \\ \vdots \\ \ell_p \end{pmatrix}$, and the goal is to find a matrix which returns $\psi = \dfrac{\ell_1+\ell_2+\cdots+\ell_q}{\ell_1+\ell_2+\cdots+\ell_p}$, where $q \leq p.$

Is there any matrix $M$ such that $\ell M = \psi$?

  • You appear to have defined $\psi$ to be a scalar, which doesn't really make sense if $M$ is a matrix. – gandalf61 Jul 17 '18 at 12:54
  • @gandalf61 Yes it is a scalar. Then can there be any vector $m$ such that $\ell m = \psi$? – HyeonPhil Youn Jul 17 '18 at 13:04
  • If you make $m$ the row vector with the first $q$ entries $\frac{1}{\ell_1+\ell_2+\dots+\ell_p}$ and all other entries $0$ then $m\ell = \psi$. But $\ell m$ can never be a scalar if you are using the usual order of multiplication. – gandalf61 Jul 17 '18 at 13:21
  • Let $m_k$ denote a vector whose first $k$ elements equal unity and whose remaining elements equal zero. Your function can be written as $$\psi = \frac{m_q^T\ell}{m_p^T\ell}$$ If you wish, you could collect this pair of vectors into a binary matrix $M=m_qm_p^T,,$ and define a custom "product" operation which yields the form that you seek $$\psi=\ell\star M$$ – greg Jul 17 '18 at 14:48

2 Answers2

3

Multiplying a vector by a matrix, you perform some linear transformation. From linearity it follows that

$$ A(b+c)=Ab+Ac, $$

where $A$ is a matrix and $b,c$ are vectors of the corresponding size.

Let $$ b = \begin{bmatrix} x_1 \\ y_1 \end{bmatrix}, \quad c = \begin{bmatrix} x_2 \\ y_2 \end{bmatrix} $$ and the desired function $$\psi \left( \begin{bmatrix} x \\ y \end{bmatrix} \right) = \frac{x}{x+y}\;.$$ Then you have $$ \psi(b) = \frac{x_1}{x_1+y_1}, \quad \psi(c) = \frac{x_2}{x_2+y_2}, \quad \psi(b+c) = \frac{x_1+x_2}{x_1+x_2+y_1+y_2}.\\ $$

And in general $$ \psi(b+c) \neq \psi(b)+\psi(c),$$ because the function $\psi$ is not linear. This means that this function cannot be represented as a one-side matrix multiplication.

Zeekless
  • 1,479
  • 8
  • 17
2

Of course not, a matrix/vector product is always linear.

Using dot products with vector $1_k$ of $k$ ones followed by $p-k$ zeroes,

$$\psi=\frac{1_q\cdot\ell}{1_p\cdot\ell}.$$

Anyway, you can work with homogeneous coordinates, i.e. pairs $(u,v)$ such that $(u,v)\equiv(\lambda u,\lambda v)$ for any $\lambda\ne0$ and write

$$(u,v)=\ell\,[1_q\ 1_p]^T$$ and

$$(u,v)\equiv(\psi,1).$$