# Behaviour of \`norm(::Vector{\<:Vector},p)\`

**URL:** <https://discourse.julialang.org/t/behaviour-of-norm-vector-vector-p/5059>\
**Category:** General Usage\
**Tags:** question\
**Created:** [July 25, 2017, 5:04pm UTC](https://discourse.julialang.org/t/behaviour-of-norm-vector-vector-p/5059 "2017-07-25T17:04:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dlfivefifty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlfivefifty/32/1959_2.png) [@dlfivefifty](https://discourse.julialang.org/u/dlfivefifty)\
**Post date:** [July 25, 2017, 5:04pm UTC](https://discourse.julialang.org/t/behaviour-of-norm-vector-vector-p/5059/1 "2017-07-25T17:04:17Z")

</div>

This caught me by surprise:

```julia
norm([[1,2],[3,4]],1) == norm([1,2],2)+norm([3,4],2) # == 7.24… ≠ 10

```

I had expected the norm of the components to be consistent with the norm of the vector.

Is this intentional?

---

<div class="post-metadata">

**Author:** ![jonathanBieler](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@jonathanBieler](https://discourse.julialang.org/u/jonathanBieler)\
**Post date:** [July 25, 2017, 6:20pm UTC](https://discourse.julialang.org/t/behaviour-of-norm-vector-vector-p/5059/2 "2017-07-25T18:20:54Z")

</div>

According to the doc [here](https://github.com/JuliaLang/julia/blob/master/base/linalg/generic.jl#L415), the norm for a collection is defined as:

\|A\|\_p = \left( \sum\_{i=1}^n | a\_i | ^p \right)^{1/p}

It’s not very clear what | a\_i | means in this context, but it’s using `norm(a_i,2)`:

```julia
julia> [norm([[1,2],[3,4]],p) == (norm([1,2],2)^p + norm([3,4],2)^p)^(1/p) for p=1:5]
5-element Array{Bool,1}:
 true
 true
 true
 true
 true

```

I have no idea what the norm of a collection should be, so I don’t know if that makes sense, but I’m sure someone thought about it before writing the code.

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [July 25, 2017, 6:28pm UTC](https://discourse.julialang.org/t/behaviour-of-norm-vector-vector-p/5059/3 "2017-07-25T18:28:23Z")

</div>

[https://github.com/JuliaLang/julia/pull/22945](https://github.com/JuliaLang/julia/pull/22945)

---

<div class="post-metadata">

**Author:** ![dlfivefifty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlfivefifty/32/1959_2.png) [@dlfivefifty](https://discourse.julialang.org/u/dlfivefifty)\
**Post date:** [July 25, 2017, 6:35pm UTC](https://discourse.julialang.org/t/behaviour-of-norm-vector-vector-p/5059/4 "2017-07-25T18:35:45Z")

</div>

Coincidental timing. @stevengj gave the answer:

“@andreasnoack, we assume that T is a normed space, i.e. it must have norm(x), but it may not have norm(x, p). And once we define it that way for an arbitrary T, we should be consistent and define it that way for vectors of vectors as well.”
