I was looking at some equivalent definitions of a tree in graph theory and one is the following where we let $G$ be an undirected graph:
$G$ is a tree iff $G$ is connected and has $n-1$ edges where $n$ denotes the number of vertices in $G$.
My question is why is there the restriction that $G$ is connected here? Isn't it true that $G$ is a tree iff $|E(G)|=|V(G)|-1$? I thought $|E(G)|=|V(G)|-1$ implies that $G$ is connected.
You mean $|E|=|V|-1$, not $|V|=|E|-1$.
You can have a graph with four vertices, three of which are conected with three edges but isolated from the remaining one. This graph clearly complies with $|E|=|V|-1$, but is not connected.