A washing machine comprising: a tub; a drum rotatably disposed in the tub; a detergent supplier configured to supply a detergent to the tub; a water supplier configured to supply a water to the tub; an optical sensor provided on a lower part of the tub, wherein the optical sensor includes a light emitting element and a light receiving element configured to selectively receive a plurality of visible rays having different wavelengths and an infrared ray, among a light emitted from the light emitting element; and a controller configured to control the water supplier to supply the detergent and the water to the tub and rotate the drum during a washing, wherein the controller is configured to: control the optical sensor to emit the light, receive received intensities of the plurality of visible rays and a received intensity of the infrared ray from the optical sensor, characterized in that the controller is further configured to: identify a concentration of particles, a size of particles and a dye floating in the water based on a sum of the received intensities of the plurality of visible rays and the received intensity of the infrared ray, and adjust a washing time based on the concentration of particles, the size of particles and the dye. a tub; a drum rotatably disposed in the tub; a detergent supplier configured to supply a detergent to the tub; a water supplier configured to supply a water to the tub; an optical sensor provided on a lower part of the tub, wherein the optical sensor includes a light emitting element and a light receiving element configured to selectively receive a plurality of visible rays having different wavelengths and an infrared ray, among a light emitted from the light emitting element; and a controller configured to control the water supplier to supply the detergent and the water to the tub and rotate the drum during a washing, wherein the controller is configured to: control the optical sensor to emit the light, receive received intensities of the plurality of visible rays and a received intensity of the infrared ray from the optical sensor, characterized in that the controller is further configured to: identify a concentration of particles, a size of particles and a dye floating in the water based on a sum of the received intensities of the plurality of visible rays and the received intensity of the infrared ray, and adjust a washing time based on the concentration of particles, the size of particles and the dye. control the optical sensor to emit the light, receive received intensities of the plurality of visible rays and a received intensity of the infrared ray from the optical sensor, characterized in that the controller is further configured to: identify a concentration of particles, a size of particles and a dye floating in the water based on a sum of the received intensities of the plurality of visible rays and the received intensity of the infrared ray, and adjust a washing time based on the concentration of particles, the size of particles and the dye. identify a concentration of particles, a size of particles and a dye floating in the water based on a sum of the received intensities of the plurality of visible rays and the received intensity of the infrared ray, and adjust a washing time based on the concentration of particles, the size of particles and the dye.