11
$\begingroup$

Is this even possible? Since you can subtract on the right-hand side I think there must be a way to do it from left-hand side too.

I would like to calculate this:

3 - [2 1] = ??

$\endgroup$
5
  • $\begingroup$ What about $[1,2]$? $\endgroup$
    – Fabian
    Commented Aug 9, 2012 at 11:50
  • $\begingroup$ So I assume I should do [(x1-S)*(-1) (x2-S)*(-1)]? $\endgroup$
    – c0dehunter
    Commented Aug 9, 2012 at 11:55
  • $\begingroup$ By definition, you can only add/subtract matrices of the same dimension. $\endgroup$
    – Daryl
    Commented Aug 9, 2012 at 12:08
  • 1
    $\begingroup$ While Daryl is right, some programming languages may allow you to do something like 3 - [2, 1]. They do this by converting scalar to appropriate size matrix. So 3 - [2, 1] is same converted to [3, 3] - [2, 1] which gives [1, 2] as the final result (as suggested by Fabian). $\endgroup$
    – mythealias
    Commented Aug 9, 2012 at 12:23
  • $\begingroup$ I need this in C language and I have this case. I've double checked everything and it comes down to this equation. So you are saying that if I got this equation there must be something else wrong in my algorithm? $\endgroup$
    – c0dehunter
    Commented Aug 9, 2012 at 12:57

2 Answers 2

16
$\begingroup$

You can't actually add a scalar and a matrix. In general, you can't add two matrices unless they are of the same dimension. However, it is often the case that we denote a scalar matrix (a diagonal matrix all of whose entries are the same) by a scalar. For example, you might write $4$ to denote the matrix $\begin{bmatrix}4 & 0 \\ 0 & 4\end{bmatrix}$. The dimension of the matrix has to be understood from context. This notation allows one to write, for example, $$ 4-\begin{bmatrix}1 & 2 \\ 3 & 4\end{bmatrix}=\begin{bmatrix}4 & 0 \\ 0 & 4\end{bmatrix}-\begin{bmatrix}1 & 2 \\ 3 & 4\end{bmatrix}=\begin{bmatrix}3 & -2 \\ -3 & 0\end{bmatrix} $$ In your case, however, I have never seen a scalar used to denote a non-square matrix.

$\endgroup$
5
  • $\begingroup$ So you say my case is uncalculable - or is Fabian right? $\endgroup$
    – c0dehunter
    Commented Aug 9, 2012 at 12:55
  • $\begingroup$ I guess you could always define notation such that by $3$ you mean $[3,3]$, in which case Fabian is correct, but I don't think many people would do this. In this case, the expression $3-[1,2]$ just doesn't make sense. $\endgroup$ Commented Aug 9, 2012 at 13:35
  • $\begingroup$ Just to clarify: I did not state that the expression is usually interpreted as [1,2]. In fact, most people would say it is undefined. However, if you really want to give it a meaning [1,2] is the only way I could possibly do so. $\endgroup$
    – Fabian
    Commented Aug 9, 2012 at 15:25
  • $\begingroup$ Please explain - is Fabian's way mathematically correct? Or you can't do substraction this way like you can't divide a number with zero? $\endgroup$
    – c0dehunter
    Commented Aug 9, 2012 at 17:12
  • 1
    $\begingroup$ For all intents and purposes, $3-[1,2]$ is not defined. $\endgroup$ Commented Aug 9, 2012 at 22:11
2
$\begingroup$

The previous answers that basically say "No, addition/subtraction is not defined between matrices of different dimensions" are the correct answer to your question.

Actually though, something like this is done formally in Clifford algebras. There are elements of the algebra identified with scalars, elements identified as vectors, (and even more elements with different identifications). Because they all live in an algebra, addition, subtraction and multiplication are defined between all of them.

However, this last item is probably not the answer you're looking for, because the addition is just formal: a scalar $\lambda$ plus a vector $v$ is just "$\lambda +v$", and there isn't a formula which presents it as another scalar, or another vector.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .