Create Willies Prog 2 

#WE ASSUME THAT var Y is already in our environment 
#first ,matrix is cached to zero ,
#through solve () is defined how the inverse of the matrix defined (matrix should be a square one.)

makeCacheMatrix <- function(x = matrix(data = as.vector(y),nrow= nummeric(a),ncol=nummeric(b)  ) ) {
  if(dim(x)<=a*b){
       matrixcache<- NULL
        set <- function(y) {
                x <<- y
                matrixcache<<- NULL
        }
        get <- function() x
        setinv <- function(solve) inv <<- solve(x)
        getinv <- function() inv
        list(set = set, get = get,
             setinv = setinv,
             getinv = getinv)
       # inverse saved first in this list 
}
  
  
}

## solving or inversing the cache matrix that u had just made

cacheSolve <- function(x) {
        inv <- x$getinv()
        if(!is.null det((inv)) {
                message("getting cached data")#make sure the det ist       not 0 4 inverse 
                return(inv)
        }
        data <- x$get()
       inv <- inv(data)
        x$setinv(inv)
        inv

        ## Return a matrix that is the inverse of 'x'
}


```









```{r}
makeVector <- function(x = numeric()) {
        m <- NULL
        set <- function(y) {
                x <<- y
                m <<- NULL
        }
        get <- function() x
        setmean <- function(mean) m <<- mean
        getmean <- function() m
        list(set = set, get = get,
             setmean = setmean,
             getmean = getmean)
}

```

You can also embed plots, for example:

```{r, echo=FALSE}
#The following function calculates the mean of the special "vector" created with the above function. However, it first checks to see if the mean has already been calculated. If so, it gets the mean from the cache and skips the computation. Otherwise, it calculates the mean of the data and sets the value of the mean in the cache via the setmean function.

cachemean <- function(x, ...) {
        m <- x$getmean()
        if(!is.null(m)) {
                message("getting cached data")
                return(m)
        }
        data <- x$get()
        m <- mean(data, ...)
        x$setmean(m)
        m
}

In order to complete this assignment, you must do the following:

Fork the GitHub repository containing the stub R files at https://github.com/rdpeng/ProgrammingAssignment2 to create a copy under your own account.
Clone your forked GitHub repository to your computer so that you can edit the files locally on your own machine.
Edit the R file contained in the git repository and place your solution in that file (please do not rename the file).
Commit your completed R file into YOUR git repository and push your git branch to the GitHub repository under your account.
Submit to Coursera the URL to your GitHub repository that contains the completed R code for the assignment.
In addition to submitting the URL for your GitHub repository, you will need to submit the 40 character SHA-1 hash (as string of numbers from 0-9 and letters from a-f) that identifies the repository commit that contains the version of the files you want to submit. You can do this in GitHub by doing the following