From an LDS perspective, this idea isn't simply believed, but explicitly stated as doctrine in the Book of Mormon. It uses the central idea of opposition, which is touched on at various points in the Book of Mormon, but most clearly in chapter 2 of 2 Nephi. The basic idea is that the contrast between two opposing principles is what distinguishes them from one another, and therefore the existence of opposition is a necessary part of God's plan.
11 For it must needs be, that there is an opposition in all things.
If not so, my firstborn in the wilderness, righteousness could not be
brought to pass, neither wickedness, neither holiness nor misery,
neither good nor bad. Wherefore, all things must needs be a compound
in one; wherefore, if it should be one body it must needs remain as
dead, having no life neither death, nor corruption nor incorruption,
happiness nor misery, neither sense nor insensibility.
12 Wherefore, it must needs have been created for a thing of naught;
wherefore there would have been no purpose in the end of its creation.
Wherefore, this thing must needs destroy the wisdom of God and his
eternal purposes, and also the power, and the mercy, and the justice
13 And if ye shall say there is no law, ye shall also say there is no
sin. If ye shall say there is no sin, ye shall also say there is no
righteousness. And if there be no righteousness there be no happiness.
And if there be no righteousness nor happiness there be no punishment
nor misery. And if these things are not there is no God. And if there
is no God we are not, neither the earth; for there could have been no
creation of things, neither to act nor to be acted upon; wherefore,
all things must have vanished away.
14 And now, my sons, I speak unto you these things for your profit
and learning; for there is a God, and he hath created all things, both
the heavens and the earth, and all things that in them are, both
things to act and things to be acted upon.
15 And to bring about his eternal purposes in the end of man, after
he had created our first parents, and the beasts of the field and the
fowls of the air, and in fine, all things which are created, it must
needs be that there was an opposition; even the forbidden fruit in
opposition to the tree of life; the one being sweet and the other
16 Wherefore, the Lord God gave unto man that he should act for
himself. Wherefore, man could not act for himself save it should be
that he was enticed by the one or the other.
17 And I, Lehi, according to the things which I have read, must needs
suppose that an angel of God, according to that which is written, had
fallen from heaven; wherefore, he became a devil, having sought that
which was evil before God.
18 And because he had fallen from heaven, and had become miserable
forever, he sought also the misery of all mankind. Wherefore, he said
unto Eve, yea, even that old serpent, who is the devil, who is the
father of all lies, wherefore he said: Partake of the forbidden fruit,
and ye shall not die, but ye shall be as God, knowing good and evil.
19 And after Adam and Eve had partaken of the forbidden fruit they
were driven out of the garden of Eden, to till the earth.
20 And they have brought forth children; yea, even the family of all
21 And the days of the children of men were prolonged, according to
the will of God, that they might repent while in the flesh; wherefore,
their state became a state of probation, and their time was
lengthened, according to the commandments which the Lord God gave unto
the children of men. For he gave commandment that all men must repent;
for he showed unto all men that they were lost, because of the
transgression of their parents.
22 And now, behold, if Adam had not transgressed he would not have
fallen, but he would have remained in the garden of Eden. And all
things which were created must have remained in the same state in
which they were after they were created; and they must have remained
forever, and had no end.
23 And they would have had no children; wherefore they would have
remained in a state of innocence, having no joy, for they knew no
misery; doing no good, for they knew no sin.
24 But behold, all things have been done in the wisdom of him who
knoweth all things.
-- 2 Nephi 2: 11-24