Proving that a relation is an equivalence relation by proving it is transitive

I came up with this question , which I have to prove that it is an equivalence relation

Define a function f : R → R by f(x) = x^2 + 1. For a, b ∈ R define a ≃ b to mean that f(a) = f(b)

I have done proving that it is a reflexive and also symmetric , I am bit stuck at the transitive part Thankyou so much.

• Suppose $a \sim b$ , and $b \sim c$. Then, $f(a) = f(b)$, and $f(b) = f(c) \implies f(a) = f(c)$. Thus, $a \sim c$ by definition. – P-addict May 17 at 16:00
• thank you so much @P-addict – lasan manujitha May 17 at 17:15

If $$f(a)=f(b)$$ and $$f(b)=f(c)$$, then $$f(a)=f(c)$$. This works for every function, not just for that one.