Objective:
Near the beginning of a linear algebra course the basic operations of matrix
addition and scalar multiplication are combined to define linear combinations
of vectors or matrices. We stress that linear combinations are the tools
for building other objects. We can show this geometrically in R2
and
R3, but this colorful demo provides a realistic example
of linear combinations in action.
Level:
A beginning linear algebra course.
Prerequisites:
Students
should be familiar with the basic operations of matrix addition and scalar
multiplication and the notion of a linear combination.
Platform:
A
browser that supports Java or a
computer system with MATLAB .
The Java Applet which is in RGBExample.zip
and the MATLAB m-file rgbexamp provide a demonstration of colors
as a linear combination of RED, GREEN, and BLUE using their intensities
as coefficients. Sliders control the selection of the intensity of
each color. After moving the sliders to the desired intensity, in
MATLAB click the apply button to see the color formed and a display of
the linear combination. In the Java Applet the colors change automatically
as the sliders move and are released. A sample screen from the MATLAB implementation
is shown below.
Download the following MATLAB GUI demo.
In Netscape, press shift and simultaneously
click on the file to save this file to your disk. Make sure
you place the file in a directory that is in the MATLAB path.
rgbexamp.m
(MATLAB v 5.3 Release 11)
To experiment with the Java Applet click
on RGBJAVA
To download the Java Applet click on
RGBExample.zip
which must be unzipped in order to execute
the routine.
Instructor's Notes:
A display screen S is really a matrix
of pixels and each entry of matrix S has a 3-vector of RGB intensities
associated with it. Let R, G,
and B be matrices of the same size
as S, where matrix R contains
the red intensities of the pixels of S, G
the green intensities, and B
the blue intensities. Thus the configuration of colors shown on screen
S
depends upon the information in the three matrices R,
G,
and B.
Since the color of each pixel is a blend
of the three light sources, this situation amounts to saying that
S = R
+ G + B.
At a single pixel, the color of
the pixel is determined by a
linear combination of the 3-vectors
in
C = {[1 0 0], [0 1 0], [0 0 1]}
where the coefficients, the RGB intensities,
are restricted to have values between 0 and 1. For example in MATLAB,

The accompanying Java Applet in RGBExample.zip
and the MATLAB m-file, rgbexamp.m, let students or instructors experiment
with linear combinations to form colors. A discussion on how to form, white,
black, red, green, and blue by selecting intensities has been helpful in
providing students with a useful example of linear combinations.
Credits:
This demo and the MATLAB m-file were submitted by
Dr.
David R. Hill
Department of Mathematics
Temple University
and is included in Demos
with Positive Impact with his permission. The Java Applet was
written by Joshua Kraft, a student at Temple University, and is included
with his permission.