WEBVTT

00:00.360 --> 00:01.350
Welcome back.

00:01.530 --> 00:05.010
I want to talk to you quickly about something called Matrix.

00:05.750 --> 00:15.380
And a matrix is a way to describe 2D lists or multi dimensional lists.

00:15.410 --> 00:16.310
What do I mean?

00:16.490 --> 00:24.620
Well, I can create a matrix, and this is a name that I just made, so I can call it whatever I want.

00:24.650 --> 00:27.350
But usually these are called matrix and programming.

00:28.050 --> 00:29.660
And it looks something like this.

00:29.670 --> 00:30.870
It's an array.

00:31.560 --> 00:33.480
With another array inside of it.

00:34.530 --> 00:36.420
So let's say, for example.

00:39.400 --> 00:41.320
I have one, two, three here.

00:42.310 --> 00:47.410
And then another array one or let's do two for.

00:48.470 --> 00:49.220
Six.

00:50.110 --> 00:52.020
And then another array.

00:52.030 --> 00:54.280
Seven, eight, nine.

00:55.190 --> 00:56.510
What's happening here?

00:56.870 --> 00:59.360
Well, it's a two dimensional array.

00:59.540 --> 01:02.300
We have the main array.

01:03.240 --> 01:07.590
And then we have sub arrays, three arrays to be exact.

01:07.830 --> 01:10.230
Now, why is this useful?

01:10.350 --> 01:15.240
And by the way, this is two dimensional, but we can have multiple ones.

01:15.240 --> 01:19.350
For example, you can have another array inside of this array.

01:21.560 --> 01:23.360
But why is this important?

01:24.500 --> 01:31.280
These type of matrices come up a lot in topics like machine learning or image processing.

01:31.760 --> 01:36.320
For example, a computer doesn't really know what a photo of a dog is.

01:36.980 --> 01:39.960
The only thing it understands is zeros and ones.

01:39.980 --> 01:41.570
So a lot of photos.

01:41.570 --> 01:49.520
For example, let's say we had a very simple photograph of a giant X, maybe this letter x.

01:49.940 --> 01:57.170
Well, a computer can understand an image based on pixels on the screen, so maybe we can have zero,

01:57.260 --> 01:59.690
one, zero.

02:01.130 --> 02:09.140
100 or sorry, one here, zero here, and then one.

02:09.590 --> 02:12.290
And right now, a computer can look at this.

02:12.290 --> 02:19.400
And if this represented, let's say, a tiny little pixel here or maybe a pixel here on my screen,

02:19.580 --> 02:22.640
the computer is going to say, oh, there's a one here.

02:22.640 --> 02:30.560
So that means I should make this green in this corner, then dark here, then green, then dark green,

02:30.560 --> 02:32.810
dark green, dark green.

02:32.990 --> 02:37.070
And a computer is able to draw, let's say, an X.

02:37.400 --> 02:39.620
And this is a simple example.

02:39.620 --> 02:44.360
And using matrices, we can do a lot of these heavy calculations.

02:44.360 --> 02:49.430
And that's how computers work underneath the hood when, let's say, for example, it's trying to display

02:49.430 --> 02:50.060
something.

02:50.060 --> 02:58.400
But the reason I wanted to talk about this here is when you want to access a multi dimensional list,

02:58.460 --> 03:02.600
well, you would do something like this, let's say matrix.

03:04.080 --> 03:06.900
Access the first item.

03:07.820 --> 03:14.600
In The Matrix, which in this case will be this first array because it's the first item.

03:14.600 --> 03:19.640
And then let's say we want to access the zero in here or let's change this to five.

03:19.850 --> 03:24.230
Well, I'll do square brackets again and just do zero one.

03:24.230 --> 03:25.280
So if I go.

03:26.660 --> 03:28.730
One here, and let's print that out.

03:33.640 --> 03:34.750
And I click Run.

03:36.570 --> 03:37.760
I get five.

03:37.770 --> 03:40.380
So it's accessing the first item in the array.

03:40.380 --> 03:46.500
So it's going to look at the first order array, grab the first item which is right here, and then

03:46.500 --> 03:49.200
grab the second item in that array.

03:49.200 --> 03:52.050
So zero one, which is five.

03:53.060 --> 03:54.500
And you can keep doing this.

03:54.500 --> 03:59.270
If he had multi dimensional arrays, you can keep adding, keep adding, keep adding.

04:00.360 --> 04:04.610
To access that information from an array or list.

04:04.620 --> 04:08.070
But remember in Python, we want to use the term list.

04:08.730 --> 04:09.810
I'll see you in the next one.

04:10.080 --> 04:10.710
Bye bye.
