Help understanding how to Evaluate divisions

45 Views Asked by At

Morning to everyone,

I am trying to understand a problem I came across, which I can solve but I still do not understand the logic behind it.

The problem is as follow

Input: equations = [["a","b"],["b","c"]], values = [2.0,3.0], queries = [["a","c"],["b","a"],["a","e"],["a","a"],["x","x"]]

Output: [6.00000,0.50000,-1.00000,1.00000,-1.00000]

The equation is represented in the following manner:

a/b = 2 | b/c = 3

I need to find the value of the queries i.e.

a/c and b/a

The output for a/c is 6 and for b/a is 0.5

I understand how this result is achieved but not the logic.

For example: to get a/c we do the following a/c = a/b x b/c -> (the two b cancel each other) -> you're left with a/c -> which gives you 6 (because a/b =2 and b/c = 3 -> 2x3 = 6)

I have two questions here:

  1. If a/b is equal 2 then when the b gets cancelled, how is a alone equal 2?(same for b/c)

  2. If the result is a/c why is this represented as a division but the result is achieved by multiplying?

This obviously shows that I don't have a good grasp on algebra and I will be revising this, my understanding is that this specific type of calculation is part of linear algebra variable division? or is there a specific topic I can read to understand this part specifically (and then start from the basics of algebra)

Thank you

1

There are 1 best solutions below

0
On

If a/b is equal to 2 then when the b gets cancelled, how is a alone equal 2?(same for b/c)

That's not how it works. Consider $$\frac ac = \frac ab \times \frac bc = 2\times3 = 6$$

It doesn't tell you anything about $a$ in particular. You know $\frac ac$ is 6 and nothing else. There are multiple solutions to his i.e: multiple choices of $a$ and $c$ that make this work. For instance $a=2$ and $c=\frac13$. But also $a=6$ and $c=1$.


If the result is a/c why is this represented as a division but the result is achieved by multiplying?

You are multiplying fractions. And the result of this product of fractions is again a fraction.


Ask questions in the comments if something is unclear. Cheers!