<p>First, see <a href="https://cseducators.stackexchange.com/q/4717/1293">this question on being pedantic</a>. Second, consider the fact that you are teaching Computer Science and not Mathematics. The former is not a subset of the latter. There is some overlap, of course. </p>

<p>Next, I see no issue with being precise about terminology when students might be studying both fields. If you want to clearly distinguish between vector and array, I think that is fine, though you may possibly just be stressing the wrong thing. </p>

<p>Vectors in mathematics are used to <em>understand</em> things. (That is the core of pure math, after all). Arrays, call them what you will, in CS are used to <em>build</em> things that are useful. </p>

<p>But lots of things vary between math and CS. Addition of integers means one thing in math. The fact that it normally means modulo addition (with a fairly large modulus) is seldom stressed initially and is irrelevant for many (not all) purposes. Likewise real values mean quite different things in math and in CS. If you spend too much time on the details of the differences you may not have time for what are, fundamentally, more important issues in novices learning CS. </p>

<p>But, the reason that Matrix isn't a fundamental type in a language like Java is that it isn't needed often enough in the work of professionals to make it part of the infrastructure. You can, of course, build a Matrix class and provide the mathematical operations that might be wanted for some applications, just as Mathematica has done. </p>

<p>But, mathematics is like CS language structure in a lot of ways. In math the Peano axioms are, for example, enough to define the structure of the natural numbers. Other things can be defined and built on top of that structure. Likewise in Java, a Vector of Objects is a (somewhat) simple bit of infrastructure that can be used as the basis of more complicated and useful things. So, in both, one has a simple basis that can be extended for the purpose at hand. </p>

<p>I'll note also, that few <em>general purpose</em> programming languages have anything like a matrix as a primitive. Normally a two dimensional structure is more like an array of arrays (vector of vectors) and so in the second dimension the index limits can vary. But OO languages can, of course, control that and have "true" matrices, though a "row" and a "column" in such a structure are quite different in the implementation. But, again, in mathematics the row and the column are <em>ideas</em>, and in CS they are implementations (built things). </p>

<p>Well... I suppose that any Turing Complete language is "general purpose" in some sense. </p>

CC BY-SA 4.0
2019-07-04T15:40:11.787Z
2019-07-04T16:00:28.053Z
2019-07-04T16:00:28.053Z
Buffy
<p>You are correct and incorrect at the same time. Nomenclature is important when teaching, and when programming. Being pedantic about nomenclature is a slipper slope and a morass. As noted by @Buffy in another answer, that's been addressed here as well.</p>

<p>In the case of <code>vector</code> and <code>matrix</code> they have specific meaning, usage, and properties in mathematics. They also have many other meanings, in different fields. (See <a href="https://en.wiktionary.org/wiki/matrix#English" rel="noreferrer"><code>matrix</code></a> and <a href="https://en.wiktionary.org/wiki/vector#English" rel="noreferrer"><code>vector</code></a> in Wiktionary.) There is a similar problem with many words used in CS; 'table' (a flat surface for food or work) and 'case' (an enclosure for holding or carrying things) are two examples I can think of. </p>

<p>When teaching something it is important to ensure that the students understand the terms you are using. If they have prior knowledge of some terms from another field, it can help to compare and contrast the usage in CS and the other field. It is also important for the students to understand that what a term means in this field may not be the same, or even close, as the same term in a different field. Unfortunately, mathematics and computer science are very close, often intertwined, and the terms are often very close, and that can make correct usage of nomenclature much harder.</p>

<p>I suppose it becomes even more difficult when the language used in the field is also a foreign language to the students. The key is to correctly use the terms from the field you are working with, even if Java has the data structure <code>Vector</code> which doesn't behave the same as a "vector" in mathematics. The mathematics "vector" also has no correlation to the "vector" which is the carrier of a disease-causing agent. Neither is more <em>correct</em>, nor less so. When used correctly in their field they are understood. When used outside their field, they can be easily confused. Focus on what it means, here and now, in your course, not what it might mean somewhere else. After all, the CS field cannot just create new words for everything merely because all the words are already taken.</p>

CC BY-SA 4.0
2019-07-04T17:01:56.753Z
2019-07-04T17:01:56.753Z
Gypsy Spellweaver
<p>I believe that the CS notion of a vector is not related to the concept of a vector as a fixed size set of components, and rather comes from the idea of a rank 1 tensor (which is also called a vector). A rank 1 tensor is simply a list of elements that is indexed linearly, so you only need one coordinate to retrieve an element (as opposed to a matrix, which is a rank 2 tensor, which requires two coordinates to locate an element).</p>

<p><a href="http://mathworld.wolfram.com/TensorRank.html" rel="noreferrer">Here is a link to Wolfram MathWorld about tensor rank</a></p>

<p>Also, I think that I'd take some issue with your definition of matricies and vectors as "mathematical entities that can be added, multiplied and so on." Matricies and vectors in mathematics each are defined based on their structures, and from those structures we can define convenient operations/properties such as multiplication, addition, etc. Thus matricies and vectors in CS are both still fundamentally the same as mathematical matricies and vectors because they share the same structure. However (for non-numerical types) they will not have the same properties as we have with numbers in mathematics.</p>

CC BY-SA 4.0
2019-07-04T14:40:06.480Z
2019-07-04T14:46:31.940Z
2019-07-04T14:46:31.940Z
thesecretmaster
<p>When introducing terms that have different meanings in different fields, first, accept that both uses are correct.  As others have alluded, this is a case of two different fields using the same term in two different ways based on a similarity to a root idea.  Disparaging the use of the language to your students might make them feel worse about the usage, or might make them feel worse about you, but it won't change the accepted term of art in the field, so there is no benefit to your complaint.</p>

<p>Second, don't skip past it. Mention both uses to your class, and remind them that they will need to keep context in mind when they encounter the term in the future, as it has two different accepted meanings.</p>

<p>Hopefully your students, as a result of your instruction, have less confusion than you did.  If so, congratulations on a job well done!</p>

CC BY-SA 4.0
2019-07-05T00:57:45.033Z
Thanks! My confusion was introduced by one of my professors during my undergraduate course. He was a mathematician working with computer science. Maybe this was the reason. I will correct it now, thank you!
davidbuzatto
CC BY-SA 4.0
2019-07-04T17:55:45.653Z
2019-07-04T17:55:45.653Z
Ben I.
<p>I'm from Brazil and I'm involved with programming language teaching for, at least, ten years. I have a background in computer science and my colleagues tend to use the term <code>vector</code> to describe an array in programming languages like C or Java. I particularly HATE this use of the therm vector, since vectors and matrices are mathematical entities that can be added, multiplied and so on, while arrays and multidimensional arrays can't. I know that there are languages that these constructs exists, like MATLAB, but they don't exists natively in the most used general purpose programming languages. In Java there is an data structure called <code>Vector</code>, that is, in fact, a synchronized list that can't be added, for exaxmple. C++ also has a <code>vector</code> data structure/container in STL that is a list too and is not a mathematical vector.</p>

<p>I always explain this for my students, that some people call arrays as vectors and multidimensional arrays as matrices and that this is kinda wrong. I tell them that an array can be used to represent a vector, but that it is not a vector! The same for matrices.</p>

<p>I would like to know what do you think about it! Do you think that is correct or not to call arrays as vectors? If so, why? Is this "missconception" common in your country?</p>

<p><strong>EDIT</strong></p>

<p>I'm sorry if I sounded pedantic. My confusion was introduced by one of my professors during my undergraduate course. He was a mathematician/physicist working with computer science. Maybe this was the reason. I will correct it now, thank you!</p>

CC BY-SA 4.0
2019-07-05T02:25:16.777Z
Pedantry FTW!  I've been "doing" computers for almost forty years (got my CS degree 34 years ago) and **never** heard them called vectors and matrices.  Of course, I've **used them as** vectors and matrices when having to program mathematical functions like matrix manipulation.  In that case, though, I'd "load the matrix into a 2D array".
RonJohn
CC BY-SA 4.0
2019-07-05T13:55:08.900Z
@RonJohn I think like you! Tks!
davidbuzatto
CC BY-SA 4.0
2019-07-05T17:58:57.953Z
Just to be a tad pedantic myself (and maybe give you another way to think about it)..  Doesn't a mathematician call a bunch of scribbled numbers with brackets around them a vector?  It's just a list of numbers--it cannot be added, multiplied or operated upon without some external routines that are currently in your head.  Couldn't the same thing be said of an array?  It has the same properties of that thing you put on paper--a list of numbers with the potential to be operated upon.  You can totally add two vectors in a computer--just supply the subroutine.
Bill K
CC BY-SA 4.0
2019-07-07T14:20:47.977Z
Welcome to CS Educators Stack Exchange! I hope we see more of you.
Ellen Spertus
CC BY-SA 4.0
2019-07-08T12:00:44.560Z
_"vectors and matrices are mathematical entities that can be added, multiplied and so on, while arrays and multidimensional arrays can't"_ while this may have some theoretical support, the practice is entirely different with hugely popular libraries for sciences like [numpy bringing up arrays as  mathematical vectors](https://www.learnpython.org/en/Numpy_Arrays). If students come out of your class with this rigid definition, they will be very confused.
lucasgcb
<arrays>
Array or vector? Two dimensional array or matrix?
# Array or vector? Two dimensional array or matrix?

(Asked by: username_0 on 2019-07-04)

I'm from Brazil and I'm involved with programming language teaching for, at least, ten years. I have a background in computer science and my colleagues tend to use the term `vector` to describe an array in programming languages like C or Java. I particularly HATE this use of the therm vector, since vectors and matrices are mathematical entities that can be added, multiplied and so on, while arrays and multidimensional arrays can't. I know that there are languages that these constructs exists, like MATLAB, but they don't exists natively in the most used general purpose programming languages. In Java there is an data structure called `Vector`, that is, in fact, a synchronized list that can't be added, for exaxmple. C++ also has a `vector` data structure/container in STL that is a list too and is not a mathematical vector.

I always explain this for my students, that some people call arrays as vectors and multidimensional arrays as matrices and that this is kinda wrong. I tell them that an array can be used to represent a vector, but that it is not a vector! The same for matrices.

I would like to know what do you think about it! Do you think that is correct or not to call arrays as vectors? If so, why? Is this "missconception" common in your country?

**EDIT**

I'm sorry if I sounded pedantic. My confusion was introduced by one of my professors during my undergraduate course. He was a mathematician/physicist working with computer science. Maybe this was the reason. I will correct it now, thank you!

**Tags:** arrays

> **Comments:**
> **username_1**: Pedantry FTW!  I've been "doing" computers for almost forty years (got my CS degree 34 years ago) and **never** heard them called vectors and matrices.  Of course, I've **used them as** vectors and matrices when having to program mathematical functions like matrix manipulation.  In that case, though, I'd "load the matrix into a 2D array".  
> **username_0**: @username_1 I think like you! Tks!  
> **username_2**: Just to be a tad pedantic myself (and maybe give you another way to think about it)..  Doesn't a mathematician call a bunch of scribbled numbers with brackets around them a vector?  It's just a list of numbers--it cannot be added, multiplied or operated upon without some external routines that are currently in your head.  Couldn't the same thing be said of an array?  It has the same properties of that thing you put on paper--a list of numbers with the potential to be operated upon.  You can totally add two vectors in a computer--just supply the subroutine.  
> **username_3**: Welcome to CS Educators Stack Exchange! I hope we see more of you.  
> **username_4**: _"vectors and matrices are mathematical entities that can be added, multiplied and so on, while arrays and multidimensional arrays can't"_ while this may have some theoretical support, the practice is entirely different with hugely popular libraries for sciences like [numpy bringing up arrays as  mathematical vectors](https://www.learnpython.org/en/Numpy_Arrays). If students come out of your class with this rigid definition, they will be very confused.  

---

## 4 answers

### Answer by username_5 on 2019-07-04. Score: 8 | Accepted answer

First, see [this question on being pedantic](https://cseducators.stackexchange.com/q/4717/1293). Second, consider the fact that you are teaching Computer Science and not Mathematics. The former is not a subset of the latter. There is some overlap, of course.

Next, I see no issue with being precise about terminology when students might be studying both fields. If you want to clearly distinguish between vector and array, I think that is fine, though you may possibly just be stressing the wrong thing.

Vectors in mathematics are used to *understand* things. (That is the core of pure math, after all). Arrays, call them what you will, in CS are used to *build* things that are useful.

But lots of things vary between math and CS. Addition of integers means one thing in math. The fact that it normally means modulo addition (with a fairly large modulus) is seldom stressed initially and is irrelevant for many (not all) purposes. Likewise real values mean quite different things in math and in CS. If you spend too much time on the details of the differences you may not have time for what are, fundamentally, more important issues in novices learning CS.

But, the reason that Matrix isn't a fundamental type in a language like Java is that it isn't needed often enough in the work of professionals to make it part of the infrastructure. You can, of course, build a Matrix class and provide the mathematical operations that might be wanted for some applications, just as Mathematica has done.

But, mathematics is like CS language structure in a lot of ways. In math the Peano axioms are, for example, enough to define the structure of the natural numbers. Other things can be defined and built on top of that structure. Likewise in Java, a Vector of Objects is a (somewhat) simple bit of infrastructure that can be used as the basis of more complicated and useful things. So, in both, one has a simple basis that can be extended for the purpose at hand.

I'll note also, that few *general purpose* programming languages have anything like a matrix as a primitive. Normally a two dimensional structure is more like an array of arrays (vector of vectors) and so in the second dimension the index limits can vary. But OO languages can, of course, control that and have "true" matrices, though a "row" and a "column" in such a structure are quite different in the implementation. But, again, in mathematics the row and the column are *ideas*, and in CS they are implementations (built things).

Well... I suppose that any Turing Complete language is "general purpose" in some sense.


---

### Answer by username_6 on 2019-07-04. Score: 7

You are correct and incorrect at the same time. Nomenclature is important when teaching, and when programming. Being pedantic about nomenclature is a slipper slope and a morass. As noted by @username_5 in another answer, that's been addressed here as well.

In the case of `vector` and `matrix` they have specific meaning, usage, and properties in mathematics. They also have many other meanings, in different fields. (See [`matrix`](https://en.wiktionary.org/wiki/matrix#English) and [`vector`](https://en.wiktionary.org/wiki/vector#English) in Wiktionary.) There is a similar problem with many words used in CS; 'table' (a flat surface for food or work) and 'case' (an enclosure for holding or carrying things) are two examples I can think of.

When teaching something it is important to ensure that the students understand the terms you are using. If they have prior knowledge of some terms from another field, it can help to compare and contrast the usage in CS and the other field. It is also important for the students to understand that what a term means in this field may not be the same, or even close, as the same term in a different field. Unfortunately, mathematics and computer science are very close, often intertwined, and the terms are often very close, and that can make correct usage of nomenclature much harder.

I suppose it becomes even more difficult when the language used in the field is also a foreign language to the students. The key is to correctly use the terms from the field you are working with, even if Java has the data structure `Vector` which doesn't behave the same as a "vector" in mathematics. The mathematics "vector" also has no correlation to the "vector" which is the carrier of a disease-causing agent. Neither is more *correct*, nor less so. When used correctly in their field they are understood. When used outside their field, they can be easily confused. Focus on what it means, here and now, in your course, not what it might mean somewhere else. After all, the CS field cannot just create new words for everything merely because all the words are already taken.


---

### Answer by username_7 on 2019-07-04. Score: 7

I believe that the CS notion of a vector is not related to the concept of a vector as a fixed size set of components, and rather comes from the idea of a rank 1 tensor (which is also called a vector). A rank 1 tensor is simply a list of elements that is indexed linearly, so you only need one coordinate to retrieve an element (as opposed to a matrix, which is a rank 2 tensor, which requires two coordinates to locate an element).

[Here is a link to Wolfram MathWorld about tensor rank](http://mathworld.wolfram.com/TensorRank.html)

Also, I think that I'd take some issue with your definition of matricies and vectors as "mathematical entities that can be added, multiplied and so on." Matricies and vectors in mathematics each are defined based on their structures, and from those structures we can define convenient operations/properties such as multiplication, addition, etc. Thus matricies and vectors in CS are both still fundamentally the same as mathematical matricies and vectors because they share the same structure. However (for non-numerical types) they will not have the same properties as we have with numbers in mathematics.


---

### Answer by username_8 on 2019-07-04. Score: 6

When introducing terms that have different meanings in different fields, first, accept that both uses are correct. As others have alluded, this is a case of two different fields using the same term in two different ways based on a similarity to a root idea. Disparaging the use of the language to your students might make them feel worse about the usage, or might make them feel worse about you, but it won't change the accepted term of art in the field, so there is no benefit to your complaint.

Second, don't skip past it. Mention both uses to your class, and remind them that they will need to keep context in mind when they encounter the term in the future, as it has two different accepted meanings.

Hopefully your students, as a result of your instruction, have less confusion than you did. If so, congratulations on a job well done!

> **Comments:**
> **username_0**: Thanks! My confusion was introduced by one of my professors during my undergraduate course. He was a mathematician working with computer science. Maybe this was the reason. I will correct it now, thank you!  

---

