Theory:

In sexual reproduction, parents carry many characteristics that transfer to their offspring in a very complex process. Mendel tries to understand the process with the help of his experiments. But considering all the characteristics of the pea plant during the experiment will result in tedious calculation work.

To avoid such issues, Mendel had taken only seven characteristics for study. He experimented with one characteristic initially called a monohybrid cross and then with two characteristics called a dihybrid cross.
The crossing of two plants that differ in two characteristics is referred to as a dihybrid experiment.
In the dihybrid experiment, two characters (colour and shape) are considered simultaneously. Pea plant was considered for this experiment also.
Mendel identified two characteristics:
• Cotyledon colour yellow & green
• Seed shape round & wrinkled
Parental generation:

Mendel chose a pure-breeding yellow, round seed-producing plant and a pure-breeding green, wrinkled seed-producing plant to test. Two plants were chosen as parents and crossed.
Observations:
$$F1$$ generation:

Mendel first crossed pure-breeding pea plants with round yellow seeds with pure-breeding pea plants with wrinkled green seeds and noticed that first generation $$F1$$ plants produced only round yellow seeds. The $$F1$$ generation produced no-wrinkled green seeds. Based on this, he concluded that the round shape and yellow colour of the seeds were more dominant than the wrinkled shape and green colour of the seeds.

Parents: Yellow Round - ($$YYRR$$) and Green Wrinkled - ($$yyrr$$)

Gametes: $$YR$$ and $$yr$$

$$F1$$ generation: Yellow Round - $$YyRr$$

$$F2$$ generation:

When hybrids of $$F1$$ generation pea plants with round yellow seeds were cross-bred by self-pollination, four different types of seeds with different shape and colour combinations were obtained, which are second-generation or $$F2$$ generation plants. They were round and yellow, round and green, wrinkled and yellow, and wrinkled and green seeds.
In the $$F2$$ generation, the ratio of each phenotype (appearance) of seeds is $$9:3:3:1$$. This ratio is known as the Dihybrid ratio.

$$F2$$ Phenotypic ratio: $$9:3:3:1$$

$$F2$$ Genotypic ratio: $$1:2:2:4:1:2:1:2:1$$

Explanation:
Yellow ($$Y$$) predominates over ($$y$$) in cotyledon colour; round ($$R$$) predominates over wrinkled in seed shape ($$r$$). Hence, the genotype $$YYRR$$ represents the pure-breeding round yellow parent, and the genotype $$yyrr$$ represents the pure-breeding green wrinkled parent.

During gamete formation, paired genes of a character assort independently of the other pair. As a result, the dominant parent produces only one type of gamete, and each gamete carries one gene for seed colour ($$Y$$) and another for seed shape ($$R$$). So, the dominant parent's gametes ($$YYRR$$) have $$YR$$ gene content.

Similarly, the recessive parent ($$yyrr$$) produces only one type of gamete, with each one containing $$yr$$ genes. Therefore, $$F1$$ plants are formed by the union of these two types of gametes, and their genotype is $$YyRr$$. The phenotype of $$F1$$ plants is round and yellow because they contain dominant $$Y$$ and dominant $$R$$.

The $$F1$$ hybrid plants self-fertilised or cross-fertilised with one another. During gamete formation, the two factors of a character assort independently of the other pair.
Example:
The gene $$Y$$ may combine with the dominant gene $$R$$ or the recessive gene r to form a gamete. Similarly, gene $$y$$ can combine with either the dominant or recessive gener to form a gamete. As a result, $$F1$$ female dihybrid plants ($$YyRr$$) produce four different types of gametes. They are as follows: $$YR: Yr: yR: yr$$. The $$F1$$ male also produces four different kinds of gametes.
Dihybrid ratio
Results of a Dihybrid Cross:
Four types of plants:

At random, the four types of female gametes fuse with the four types of male gametes. Therefore, sixteen ($$4 x 4 = 16$$) possible combinations exist.

This combination of genes is easily understood by using a checkerboard. $$9$$ of these $$16$$ combinations produce roundyellow plants, $$3$$ produce wrinkled yellow plants, $$3$$ produce green round plants, and $$1$$ produces wrinkled green plants. Thus, in the $$F2$$ generation, plants occur in the ratio $$9:3:3:1$$.
A dihybrid cross resulted in four types of $$F2$$ offspring: $$9$$ with two dominant traits, $$3$$ with one dominant trait and one recessive trait, $$3$$ with another dominant trait and another recessive trait, and $$1$$ with two recessive traits.
Dihybrid cross results

New Combination:

In the dihybrid cross, two new combinations of traits with round green and wrinkled yellow had appeared in the $$F2$$ generation.

A video explaining the dihybrid genetic cross
Calculation of phenotypic counts in $$F2$$ generations:
Imagine growing purebred round yellow seed pea plants and wrinkled green seed pea plants in our garden. In the $$F1$$ generation, all plants are round yellow seed plants. If in $$F2$$ generation $$640$$ plants are grown, then how many of the plants are with the seeds as round yellow ($$YR$$), round green ($$yR$$), wrinkled yellow ($$Yr$$) and wrinkled green ($$yr$$), respectively?
The phenotypic ratio for $$F2$$ generations in a dihybrid cross between purebred round yellow seed pea plants and wrinkled green seed pea plants is $$9:3:3:1$$. This ratio represents the ratio between seeds as round yellow ($$YR$$), round green ($$yR$$), wrinkled yellow ($$Yr$$) and wrinkled green plants ($$yr$$).

So, if there are $$640$$ plants in the $$F2$$ generation, then the number of plants with the seeds as round yellow ($$YR$$), round green ($$yR$$), wrinkled yellow ($$Yr$$) and wrinkled green ($$yr$$) is calculated as below:

Total parts of the ratio = $$9+3+3+1 = 16$$

Divide $$640$$ plants by these $$16$$ parts, which tends to $$40$$ plants per part. Now, multiply this $$40$$ plants per part with each of the parts of the ratio.
So,

Number of parts of round yellow pea plants $$=$$ $$9$$
So, the total number of round yellow pea plants in $$F2$$ generation $$=$$ 9 $$\times$$ 40 = 360

Number of parts of round green pea plants $$=$$ 9
So, the total number of round green pea plants in $$F2$$ generation $$=$$ 3 $$\times$$ 40 = 120

Number of parts of wrinkled yellow pea plants $$=$$ $$3$$
So, the total number of wrinkled yellow pea plants in F2 generation $$=$$ 3 $$\times$$ 40 = 120

Number of parts of wrinkled green pea plants $$=$$ $$3$$
So, the total number of wrinkled green pea plants in $$F2$$ generation $$=$$ 1 $$\times$$ 40 = 40

The ratio between seeds as round yellow ($$YR$$), round green ($$yR$$), wrinkled yellow ($$Yr$$) and wrinkled green plant ($$yr$$) is: $$360:120:120:40$$
Reference: