• GreyBeard@lemmy.one
      link
      fedilink
      English
      arrow-up
      5
      ·
      7 hours ago

      To expand on what superkret said, in math there is the concept of “order of operations”. That is to say, every function in math (add, multiply, divide) has to be done in a specific order. Since multiplication comes before addition and subtraction, if you have a formula like a-xb-x, you will do xb first, then a minus the result of x*b, which would give a very different result than if you did a-x and multiplied that by b-x. This is where the parenthesis come in. You are basically saying, resolve every section in parenthesis first using the proper order, then resolve the rest.

      My original example (a)(b) was over simplified, because there is no conflict there. You can also do things like (ax)-(bx). If there is no operator though, it is assumed multiplication, and I’m unsure why that is.

    • superkret
      link
      fedilink
      English
      arrow-up
      14
      ·
      10 hours ago

      To make sure what’s inside the brackets is resolved internally before they’re multiplied with each other.

       (a)  (b)   =   a * b  
      (a+1)(b+1) =/= a+1*b+1