# Should transpose of a Vector be a Matrix?

**URL:** <https://discourse.julialang.org/t/should-transpose-of-a-vector-be-a-matrix/87444>\
**Category:** General Usage\
**Created:** [September 18, 2022, 4:26pm UTC](https://discourse.julialang.org/t/should-transpose-of-a-vector-be-a-matrix/87444 "2022-09-18T16:26:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![owiecc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/owiecc/32/8894_2.png) [@owiecc](https://discourse.julialang.org/u/owiecc)\
**Post date:** [September 18, 2022, 4:26pm UTC](https://discourse.julialang.org/t/should-transpose-of-a-vector-be-a-matrix/87444/1 "2022-09-18T16:26:44Z")

</div>

As Julia has a true 1D vector data type, shouldn’t the transpose of a Vector just be a Vector (essentially an identity operation)? See Conor Hoekstra’s comments in [APL vs BQN vs J vs Q vs NumPy vs Julia vs R - YouTube](https://youtu.be/8ynsN4nJxzU?t=1947)

I assume this stems from MATLAB where a vector is actually a 2D array and that you can, of course, transpose.

What are your thoughts about this?

---

<div class="post-metadata">

**Author:** ![ctkelley](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ctkelley/32/10684_2.png) [@ctkelley](https://discourse.julialang.org/u/ctkelley)\
**Post date:** [September 18, 2022, 4:30pm UTC](https://discourse.julialang.org/t/should-transpose-of-a-vector-be-a-matrix/87444/2 "2022-09-18T16:30:09Z")

</div>

It matters if you do a matrix vector multiplication from the left `A * x` or the right `x' *A`. A vec in Julia is a column vector, so it makes no sense to multiply it by a matrix from the left. So ` x * A` is wrong. If you try it you will get a `DimensionMismatch:` error.

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [September 18, 2022, 4:40pm UTC](https://discourse.julialang.org/t/should-transpose-of-a-vector-be-a-matrix/87444/3 "2022-09-18T16:40:56Z")

</div>

I highly reccomend [JuliaCon 2017 | Taking Vector Transposes Seriously | Jiahao Chen - YouTube](https://www.youtube.com/watch?v=C2RO34b_oPM) and [Taking vector transposes seriously · Issue #4774 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/4774). There has been a lot of thought put into this, and it’s a very complicated issue.

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [September 18, 2022, 4:47pm UTC](https://discourse.julialang.org/t/should-transpose-of-a-vector-be-a-matrix/87444/4 "2022-09-18T16:47:33Z")

</div>

In particular `v'*v` should produce a scalar while `v*v'` should be an n x n matrix. That cannot work if `v'` is just `v` since they both reduce to `v*v` in that case.
