Answer for the 1st part
Let us assume that the given 3 components are C1,C2,C3 .
Now, we have to find in how many ways we can join two edges between the connected components such that the whole graph becomes connected.
This can be done in the 3 ways
CASE 1 : We join an edge between C1 and C2 and again an edge between C2 and C3
Now, C1 has 2 vertices and C2 has 2 vertices
So, joining an edge between C1 and C2 can be done in 2*2 = 4 ways
Again C3 has 3 vertices so joining an edge can be done in 2*3 = 6 ways
So, joining an edge between C1 and C2 and then an edge between C2 and C3 can be done in (4*6)ways = 24 ways
CASE 2: We join an edge between C1 and C3 and again an edge between C3 and C2
Now, joining an edge between C1 and C3 can be done in (2 * 3) ways = 6 ways (in the similar way shown in Case 1)
an edge between C3 and C2 can be done in ( 3 * 2) ways = 6 ways
So, joining an edge between C1 and C3 and then an edge between C3 and C2 can be done in ( 6 * 6 ) ways = 36 ways
CASE 3: We join an edge in between C2 and C1 and again an edge between C1 and C3
In the similar way as in case 1 and case 2 this can be done in (2 * 2) * (2 * 3) ways = 24 ways.
So, the total number of ways to add two edges such that the graph becomes connected is (24 + 36 + 24) ways = 84 ways (ANSWER)
Answer for the 2nd part (Generalization)
Suppose we k components C1,C2,C3,........Ck and let each of the k components has v1,v2,...vk vertices
Now, let va1,va2,va3,....van be any arbitrary permutation of the numbers v1,v2,...vk and let Tk is required number of ways to form a connected graph.
Then Tk = v1 * v2 for k=2
and Tk = 1/2 * ∑ (va1 * va22 * va32 * va42 *.....*va(n-1)2* van ) for k>=3