# 2d curl formula

- [Voiceover] So after introducing the idea
of fluid rotation in a vector field like this,
let's start tightening up our grasp on this intuition
to get something that we can actually apply formulas to.
So a vector field like the one that I had there,
that's two-dimensional, is given by a function
that has a two-dimensional input
and a two-dimensional output.
And it's common to write the components of that output
as the functions p and q.
So, each one of those p and q,
takes in two different variables as it's input.
P and q.
and you might write it down as just curl,
curl of v, the vector field.
Which takes in the same inputs that the vector field does.
And because this is the two-dimensional example,
I might write,
just to distinguish it from three-dimensional curl,
which is something we'll get later on, two d curl of v.
So you're kind of thinking of this as a differential thing,
in the same way that you have, you know,
a derivative, dx is gonna take in some kind of a function.
And you give it a function and it gives you a new function,
the derivative.
Here, you think of this 2d curl, as like an operator,
you give it a function, a vector field function,
and it gives you another function,
which in this case will be scalar valued.
And the reason it's scalar valued,
is because at every given point,
you want it to give you a number.
So if I look back at the vector field,
that I have here,
we want, that at a point like this,
where there's a lot of counter-clockwise rotation
happening around it, for the curl function
to return a positive number.
But at a point like this, where there's some,
where there's clockwise rotation happening around it,
you want the curl to return a negative number.
So, let's start thinking about what that should mean.
And a good way to understand this
two-dimensional curl function
and start to get a feel for it,
is to imagine the quintessential 2d curl scenario.
Well let's say you have a point
and this here's going to be our point, xy,
sitting of somewhere in space.
And let's say there's no vector attached to it,
as in the values, p and q, and x and y, are zero.
And then let's say that to the right of it,
you have a vector pointing straight up.
Above it, in the vector field,
you have a vector pointing straight to the left,
to it's left, you have one pointing straight down,
and below it, you have one pointing straight to the right.
So in terms of the functions, what that means,
is this vector, to it's right,
whatever point it's evaluated at,
that's gonna be q is greater than zero.
So this function q, that corresponds to the y component,
the up and down component of each vector,
when you evaluate it at this point,
to the right of our xy point,
q's gonna be greater than zero.
Where as if you evaluate it to the left over here,
q would be less than zero, less than zero,
in our kind of, perfect curl will be positive example.
And then these bottom guys,
if you start thinking about what this means for,
you'd have a rightward vector below,
and a leftward vector above,
the one below it, whatever point you're evaluating that at,
p, which gives us the kind of,
left right component of these vectors,
since it's the first component of the output,
would have to be positive.
And then above it, above it here,
when you evaluate p at that point,
would have to be negative.
Where as p, if you did it on the left and right points,
would be equal to zero because there's no x component.
And similarly q, if you did it on the top and bottom points,
since there's no up and down component of those vectors,
would also be zero.
So this is just the, the very specific,
almost contrived scenario that I'm looking at.
And I want to say, hey if this should have positive curl,
maybe if we look at the information,
the partial derivative information to be specific,
about p and q, in a scenario like this,
it'll give us a way to quantify the idea of curl.
And first let's look at p.
So p starts positive, and as y increases,
as the y value of our input increases,
it goes from being positive to zero, to negative.
So we would expect, that the partial derivative of p,
with respect to y,
so as we change that y component, moving up in the plane,
and look at the x component of the vectors,
that should be negative.
That should be negative in circumstances
where we want positive curl.
So all of this we're looking at cases,
you know the quintessential case where curl is positive.
So evidently, this is a fact,
that corresponds to positive curl.
Where as q, let's take a look at q.
It starts negative, when you're at the left.
And then becomes zero, then it becomes positive.
So here, as x increases, q increases.
So we're expecting that a partial derivative of q,
with respect to x, should be positive.
Or at the very least, the situations where,
the partial derivative of q with respect to x is positive,
corresponds to positive two-dimensional curl.
And in fact, it turns out,
these guys tell us all you need to know.
We can say as a formula,
that the 2d curl, 2d curl, of our vector field v,
as a function of x and y,
is equal to the partial derivative of q with respect to x.
Partial derivative of q, with respect to x,
and then I'm gonna subtract off the partial of p,
with respect to y.
Because I want, when this is negative,
for that to correspond with more positive 2d curl.
So I'm gonna subtract off, partial of p,
with respect to y.
And this right here,
is the formula for two-dimensional curl.
Which basically, you can think of it as a measure,
at any given point you're asking,
how much does the surrounding information to that point,
look like this set-up,
like this perfect counter-clockwise rotation set-up?
And the more it looks like this set-up,
the more this value will be positive.
And if it was the opposite of this,
if each of the vectors was turned around
and you have clockwise rotation,
each of these values will become the negative
of what it had been before.
So 2d curl would end up being negative.
And in the next video, I'll show some examples
of what it looks like to use this formula.