Minimizing number of multiplication signs in Computational linear algebra for kind of such these examples

500 Views Asked by At

"The main purpose of this note is pedagogical."

i.e. $$a^{2}+ b^{2}+ c^{2}- ab- bc- ca=\left ( c- a \right )^{2}- \left ( a- b \right )\left ( b- c \right )$$ $$b^{2}- 4ac=\left ( c- a \right )^{2}- \left ( a- b+ c \right )\left ( a+ b+ c \right )$$ The right sides has fewer multiplication signs than the left ones. A famous application, what I know most that related to these results is shortening the running time of programming. I wondered about the method that Strassen did use to minimize the number of multiplication signs like that. I need to the help, thanks a real lot !
Her view (@VeronicaPhan, June 9 '21). However, should not be up to which way of decomposition. The only solution is to find the perfect-fitting decomposition in each scenario.
For the above example of mine, that is $a^{2}+ b^{2}+ c^{2}- ab- bc- ca= M^{2}+ N\left ( M+ N \right )\quad{\rm with}\;M:=c- a\!,{\rm and}\;N:=a- b.$ Interpolative decomposition kills it in an unnatural way $$\begin{bmatrix} 1 & -1 & 0\\ 0 & 1 & -1\\ -1 & 0 & 1 \end{bmatrix}= \begin{bmatrix} 1 & -1\\ 0 & 1\\ -1 & 0 \end{bmatrix}\begin{bmatrix} 1 & 0 & -1\\ 0 & 1 & -1 \end{bmatrix}= \begin{bmatrix} -1 & 1\\ 0 & -1\\ 1 & 0 \end{bmatrix}\begin{bmatrix} -1 & 0 & 1\\ 0 & -1 & 1 \end{bmatrix}\!.$$ Hence $a^{2}+ b^{2}+ c^{2}- ab- bc- ca= \left ( c- a \right )\!^{\!2}- \left ( a- b \right )\!\left ( b- c \right )\!.$

1

There are 1 best solutions below

4
On BEST ANSWER

$$b^2 - 4ac = \begin{bmatrix} a\\ b \\ c\end{bmatrix}^\top \begin{bmatrix} 0 & t_1 & t_2 - 4 \\ -t_1 & 1 & t_3 \\ -t_2 & - t_3 & 0\end{bmatrix} \begin{bmatrix} a\\ b \\ c\end{bmatrix} $$

We would like to find $t_1, t_2, t_3 \in \Bbb R$ such that the rank of the matrix is minimized. The easy first step would be to force the matrix to be rank-$2$ by making its determinant vanish. Note that

$$\det \begin{bmatrix} 0 & t_1 & t_2 - 4 \\ -t_1 & 1 & t_3 \\ -t_2 & - t_3 & 0\end{bmatrix} = t_2 (t_2 - 4) - 4 t_1 t_3$$

Via visual inspection, after some work, we conclude that $(t_1, t_2, t_3) = \color{blue}{(-1, 2, 1)}$ does make the determinant vanish. Via the eigendecomposition,

$$\begin{bmatrix} 0 & -1 & -2\\ 1 & 1 & 1\\ -2 & -1 & 0\end{bmatrix} = \begin{bmatrix} \color{red}{-1}\\ 0 \\ \color{blue}{1}\end{bmatrix} \begin{bmatrix} \color{red}{-1}\\ 0 \\ \color{blue}{1}\end{bmatrix}^\top - \begin{bmatrix} \color{red}{1}\\ \color{magenta}{-1} \\ \color{blue}{1}\end{bmatrix} \begin{bmatrix} \color{red}{1}\\ \color{magenta}{1} \\ \color{blue}{1}\end{bmatrix}^\top$$

and, thus,

$$b^2 - 4 a c = \left( \color{blue}{c} - \color{red}{a} \right)^2 - \left( \color{red}{a} \color{magenta}{- b} + \color{blue}{c} \right) \left( \color{red}{a} + \color{magenta}{b} + \color{blue}{c} \right)$$


SymPy code

>>> from sympy import *
>>> Q = Matrix([[ 0,-1,-2],
                [ 1, 1, 1],
                [-2,-1, 0]])
>>> Q.rank()
2
>>> (V,D) = Q.diagonalize()
>>> 
>>> V
Matrix([
[ 1,  1, -1],
[-1, -2,  0],
[ 1,  1,  1]])
>>> 
>>> D
Matrix([
[-1, 0, 0],
[ 0, 0, 0],
[ 0, 0, 2]])
>>> 
>>> V**-1
Matrix([
[   1,  1,    1],
[-1/2, -1, -1/2],
[-1/2,  0,  1/2]])