# Why is \`+(::Number, UniformScaling)\` deprecated?

**URL:** <https://discourse.julialang.org/t/why-is-number-uniformscaling-deprecated/6021>\
**Category:** Internals & Design\
**Created:** [September 21, 2017, 12:41pm UTC](https://discourse.julialang.org/t/why-is-number-uniformscaling-deprecated/6021 "2017-09-21T12:41:00Z")\
**Posts on this page:** 3\
**Page:** 2

<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 23, 2017, 11:29pm UTC](https://discourse.julialang.org/t/why-is-number-uniformscaling-deprecated/6021/21 "2017-09-23T23:29:12Z")

</div>

It’s only true in mathematical abstractions with cancellation (that’s the definition). This is true of groups, which have additive inverses and associativity: left-add the inverse of the common element, then re-associate so the inverses cancel. This fails for floats because they are only approximately associative. If fails for `I` in your examples because you’re mixing different groups – scalars and matrices of various sizes. `I` behaves as a certain element in each of these groups, but identifying it with all of those element would transitively cause those elements all to be identified with each other. In other words, more important than cancellation (which only works in some algebraic structures), is that equality should be an equivalence relation: i.e. it should be reflexive and transitive. If we had `ones(1, 1) == I` and `1 == I` then we’d be forced to have `ones(1, 1) == 1`; that may not seem so bad but you can also do `eye(n) == I == 1` which is worse (although somewhat mathematically defensible), but which then implies that `eye(n) == eye(m)` for all `n` and `m`! That does not seems like a good situation since those are quite different matrices with different sizes.

---

<div class="post-metadata">

**Author:** ![morningkyle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/morningkyle/32/1684_2.png) [@morningkyle](https://discourse.julialang.org/u/morningkyle)\
**Post date:** [September 24, 2017, 1:30am UTC](https://discourse.julialang.org/t/why-is-number-uniformscaling-deprecated/6021/22 "2017-09-24T01:30:20Z")

</div>

Thanks very much for your comments with more accurate definitions and clearer description of the issue!

> If fails for I in your examples because you’re mixing different groups – scalars and matrices of various sizes

I think there is no mixing of different groups when I expect true for the 2nd and 4th output. True for the 2nd is derived from the 1st, and true for the 4th is derived from the 3rd. The 1st and 2nd are in the same group or vector space, so does the 3rd and 4th.

It is a good point if I expect true for “eye(3) == 1” from the 2nd and the 4th, then I am mixing different groups.

Anyway, I think you clearly understand my question in previous post. And thanks again.

```julia
julia> eye(3) + eye(3) == eye(3) + I
true

julia> eye(3) == I
false

julia> 1 + I == 1 + 1
true

julia> 1 == I
false

```

---

<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 24, 2017, 9:13pm UTC](https://discourse.julialang.org/t/why-is-number-uniformscaling-deprecated/6021/23 "2017-09-24T21:13:20Z")

</div>

> [@morningkyle](#):
>
> I think there is no mixing of different groups when I expect true for the 2nd and 4th output.

Yes, but if those were both true then we would be forced to have `eye(3) == I == 1` and therefore `eye(3) == 1` by transitivity. You could throw out transitivity in favor of cancellation, but I suspect that would not be a wise move.

[Previous page](https://discourse.julialang.org/t/why-is-number-uniformscaling-deprecated/6021.md?page=1)
