Proof for a graph distance

9.7k Views Asked by At

For Graph $G$, there are several $(x, y)$-paths; the shortest among them have length $2$. Thus $d(x, y) = 2$. Prove that graph distance satisfies the triangle inequality. That is, if $x,y,z$ are vertices of a connected graph $G$, then $d(x, z) ≤ d(x, y) + d(y, z).$

So basically the graph is a pentagon with one vertex in the center. I understand the logic of how to prove it, but I don't know how to write it in proof form.

Basically, I was going to say

Assume $(x,z ∈ V)$ Then $d(x,z) = 1$, therefore $d(y,z) = 2.$ Therefore $1 \le 2 + 1$ is true.

For the other case, Assume $(y,z ∈ V)$ Then $d(y,z) = 1$, therefore $d(x,z) = 2.$ Therefore $3 \le 2 + 1$ is true.

1

There are 1 best solutions below

2
On BEST ANSWER

I would approach this using a proof by contradiction. Suppose $d(x, y) + d(y, z) < d(x, z)$. By definition, $d(x, y)$ is the length of the shortest path from $x$ to $y$, and $d(y, z)$ is the length of the shortest path from $y$ to $z$. However, $d(x, z)$ is the length of the shortest path from $x$ to $z$, so $d(x, y) + d(y, z)$ can't be less than $d(x, z)$. So we have a contradiction.

Notice how I generalize here, rather than using specific examples. Remember that example is not valid proof, unless you are using a counterexample to disprove something.