I just learn today:

Je porte des pantalon.
Je ne porte pas de pantalon.

Why for the negative, you use de? Why can't you use le or des?

Salut encore!

Check the first sentence because the last word has to be plural.
Je porte des pantalons. (I am wearing some trousers/pants.)

Je ne porte pas de pantalon. (I am wearing no trousers/pants.)

Just memorize PAS DE. ("ne...pas" is not the only negative you'll meet but it's the first.) Sometimes there isn't a reason; it just IS! Well, here's the "why" of it.

The Partitive: the idea of "some" or "any" with a noun is expressed in French by:

de + the definite article of the noun.
de beurre frais = some (any) fresh butter
de la soie = some (any) silk
de l'herbe verte = some (any) green grass
des camions = some (any) trucks
_____________________________________________

de, without the article after a negative.
Je n'ai pas fait de fautes. = I didn't make any mistakes.
Il n'a guère d'amis. = He has hardly any friends.
_____________________________________________

de, without the article , when an adjective precedes a plural noun.
de vieux souliers = some old shoes
de longues rues = long streets
______________________________________________

de, with or without the areticle, when an adjective precedes a singular noun.
*du bon cidre OR
de bon cidre. = some good cider.

* This is the more common form in the spoken language in France today.

NOTE: 1. The words for "some" and any" must be expressed in French, and must be repeated before each noun even though they are often omitted in English.

Voulez-vous du poisson? Non, je préfère de la viande et des légumes. = Do you want some fish? No, I prefer meat and vegetables.

2. Special uses of the Partitive are:
a. The definite article is retained before an adjective in the plural when the adjective is considered part of the noun.
des jeunes filles = girls
des petits pains = rolls
des petits pois = green peas
b. After "ne...que" (only), de is used with the article, provided there is no adjective preceding the noun.
Nous ne lisons que des romans. = We read only novels.
c. After "sans" (without), "ne...ne...ne" (neither...nor), and expressions taking de, the partitive is omitted.
C'est un livre sans images. = It is a book without any pictures.
Nanette ne boit ni thé ni café. = Nancy drinks neither tea nor coffee.
As-tu besoin de billets? = Do you need (any_ tickets?
______________________________________________

The idea of "some" or "any" is translated by "en" if the noun is omitted. "En," like personal pronoun objects, precedes the verb, except in affirmative commands.
A-t-il écrit ds lettres? = Has he written any letters?
Oui, il en a écrit. = Yes, he has written some.
Ecrivez-en. = Write some
______________________________________________

ADVERBS OF QUANTITY: Certain adverbns expressing quantity are followed by "de," without the article, before a noun.

assez de (enough), autant de (as much, as many), beaucoup de (muchk many), combien de (how much, how many), combien de (how much, ho0w lany), moins de (less, fewer), peu de (little, few), plus de (mor), que de (how much, how many, used only in exclamations), tant de (so much, so many), trop de (too much, too many)

Avez-vous assez de temps et d'énergie? = Have you enouygh time and energy?
Que de fois je l'ai grondé! = How many times I've scolded him!
_____________________________________________

There are other things with "de" but I doubt you are ready at this time.
Nouns of Quantity
Nouns of Material
Possession and Relationship with "de" = you might be ready for this; let me know (Le livre de Marie, etc.)

Mme

In French, when expressing a negative statement, the word "de" is used instead of the definite article "le" or the indefinite article "des". This is because when negating a sentence, you are essentially saying "not any" or "no" instead of specifying a particular item.

To explain further, let's break down the two sentences you provided:

1. Je porte des pantalons. (I wear pants.)
In this positive sentence, the indefinite article "des" is used to indicate that you are wearing some pants, without specifying a particular number.

2. Je ne porte pas de pantalons. (I don't wear pants.)
In this negative sentence, the words "ne...pas" are used to express negation. Additionally, the word "de" is used instead of the indefinite article "des". This is because you are now saying that you do not wear any pants (not some pants), suggesting a complete absence of pants.

So, to summarize, "de" is used in negative statements in French because it conveys the idea of "not any" or "no", whereas "le" is the definite article used to specify a particular item, and "des" is the indefinite article used to denote a non-specific quantity.